Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

Tuesday, November 15, 2016

User Profile Synchronization Service does not start

User Profile Sync Service is a must-have feature in SharePoint 2013 in order to look up AD users properly via the commonly used user lookup dialog or user lookup button.

While going through many installations and configurations projects of SharePoint, the User Profile Sync Service never started right the first time on me.  It does take extra steps to properly set up and configure.

Below is the common technique to resolve the issue.


  1. Add service account user to SharePoint Farm Admin Group on SharePoint Server.
  2. Add service account user to local admin group of the SharePoint Server.
  3. Restart the Timer Service
  4. Open ADSI Edit as domain admin.
    1. Right-click and Connect To "Default naming context". 
    2. Go to "Select a well known Naming context:" and choose "Configuration". 
    3. Click [OK].
    4. Expand Configuration. 
    5. Right Click [CN=Configuration, DC....]. Select [Properties]. Select [Security].
    6. Add service account user and assign [Read] and [Replicating Directory Changes] permissions.
    7. Click [OK].
  5. Now go to Central Admin Site.
  6. Go to "Manage Service Applications"
  7. Click [User Profile Service Application]. 
    1. Check [Permissions] at the top ribbon menu. Make sure the service account user exists.
    2. Check [Administrators] at the top ribbon menu.Make sure the service account user exists with full permission.
  8. Try starting User Profile Sync Service again and see if it works.

Tuesday, May 24, 2016

Office Web Apps Server for SharePoint 2013

Here's a quick reminder about Office Web Apps for SharePoint 2013 (detail link)

There are basically three (3) steps to set up Office Web Apps.
  • Step 1: Install pre-requisites
  • Step 2: Install Office Web Apps and configure it
  • Step 3: Have SharePoint 2013 server join Office Web Apps Server.
Below is Powershelll script to set up a Office Web Apps Server in a dev SharePoint environment. Office Web Apps server is configured as a single server with HTTPS.

Step 1: Install pre-requisites via PowerShell:
Add-WindowsFeature Web-Server,Web-Mgmt-Tools,Web-Mgmt-Console,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Static-Content,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,InkandHandwritingServices,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-WCF-HTTP-Activation45


Step 2: Install Office Web Apps Server 2013 and Configure it via PowerShell.
# Install Office Web Apps Servers.
# Import SSL certificate via IIS
# (Script below uses an wildcard SSL with friendly name "*.contoso.edu")
# Then run the following on the Office Web Apps Server.
# "SQLWopi.contoso.edu" is the FQDN of the Office Web Server
# -ExternalUrl is only relevant if the server will be exposed to
# public-facing internet)
#
New-OfficeWebAppsFarm -InternalUrl "https://SQLWopi.contoso.edu" -ExternalUrl "https://SQLWopi.contoso.edu" -CertificateName "*.contoso.edu" -EditingEnabled


Step 3: Connect SharePoint 2013 server to Office Web Apps Server
# Run the following Powershell script on the SharePoint 2013 server.
#
New-SPWOPIBinding -ServerName "SQLWopi.contoso.edu"

Friday, May 13, 2016

Turn on or off SharePoint Developer Dashboard

SharePoint developer dashboard can be turned on or off via Powershell script as follows
Make sure that "Usage and Health Data Collection" service application has started first under Manage Service Applications.
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$dashboard = $contentService.DeveloperDashboardSettings
$dashboard.DisplayLevel = "On"  # "Off" will turn off dashboard
$dashboard.Update()
After the dashboard is turned on, you will see a perfmon icon in the right upper corner of SharePoint site next to "SHARE", "FOLLOW", 'EDIT" menu items.

***In case the "Usage and Health Data Collection Proxy" has not started, use the following Powershell to start it.
$SAP = Get-SPServiceApplicationProxy | 
 where-object { $_.TypeName -eq "Usage and Health Data Collection Proxy" }

Friday, April 29, 2016

SharePoint 2013 Dev Environment Installation and Configuration

Here's a refresher on how to install and configure SharePoint 2013 dev environment.



Domain = contoso.edu
  • Domain controller  = DC01 (DNS server,  Email Server, WorkflowMgr server, too.)
  • SharePoint Server = SP13 (Database Server, too)
  • Database Server instance = SP13\SQL12 on SP13 server.
  • Service Accounts:
    • contoso\SPFarm
      • local admin to sharepoint 2013 server.
      • db_creator and security_admin roles on SQL Server instance
    • contoso\SPAppPool
      • account used for Web Application's application pool.

Prerequisite Installation

  1. Log on to SP13 as local admin
  2. Run powershell command as follows (3 lines)
  3. Import-Module ServerManager
    
    Add-WindowsFeature NET-WCF-HTTP-Activation45, NET-WCF-TCP-Activation45, NET-WCF-Pipe-Activation45
    
    Add-WindowsFeature Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,WEB-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support,AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer
    
  4. Reboot SP13.
  5. Logon to SP13 as local admin
  6. Install the following prerequisites
    1. dotnetfx45_full_x86_x64.exe 
    2. MicrosoftIdentityExtensions-64.msi
    3. setup_msipc_x64.msi (Active Directory Rights Management Services Client 2.0)
    4. sqlncli.msi (SQL Server 2008 R2 Native Client Setup)
    5. Synchronization.msi (Microsoft Sync Framework Runtime v1.0 SP1 (x64)
    6. WcfDataServices.exe (WCF Data Services 5.0 (OData v3)
    7. WcfDataServices56.exe (WCF Data Services 5.6 Tools)
    8. Windows6.1-KB974405-x64.msu --> if error 0x80096002 occurs, do not install it.
    9. Windows6.1-KB2506143-x64 --> if "not-applicable-to-your-computer" error occurs, do not install it.
    10. Use command prompt as local admin and run the following (single-line):
      C:\>WindowsServerAppFabricSetup_x64.exe  /i  CacheClient,CachingService,CacheAdmin  /gac
      
    11. Install "AppFabric1.1-RTM-KB2671763-x64-ENU.exe" (Windows Server AppFabric v1.1 CU1 [KB 2671763]). If error occurs, reboot and try again.
  7. Reboot SP13.

SharePoint 2013 Installation
  1. Log on to SP13 as local admin.
  2. Mount SharePoint 2013 server iso file.
  3. Run setup.exe.
  4. Enter product key.
  5. On Server Type, select "Complete".
  6. Finish installation.
SharePoint 2013 Configuration
  1. Run SharePoint Products Configuration Wizard.
  2. Select "Create a new server farm".
  3. Specify configuration database settings
    1. Database Server = "SP13\SQL12"
    2. Database Name = "SharePoint_Config
    3. Username = contoso\spfarm
  4. Specify port number: 13311
  5. Select NTLM
  6. Do not use configuration wizard when "Welcome" page opens. Click Cancel.
  7. Change auto-generated Central Admin Content database name if needed as follows..
    1. Run the following powershell script in SharePoint Management Shell.
      $db = Get-SPContentDatabase -WebApplication "http://sp13:13311"
      Dismount-SPContentDatabase $db
      
    2. Rename the database in SQL Management Studio from "SharePoint_AdminContent_d95a4420-b726-4a73-a433-df83a2058890" to "SP13_AdminContent"
    3. User powershell to re-mount the database:
      Mount-SPContentDatabase "SP13_AdminContent" -DatabaseServer "SP13\SQL12" 
      -WebApplication "http://sp13:13311"

  8. Provision Usage and Health Data Collection Service Application
  9. $UsageService = Get-SPUsageService
    New-SPUsageApplication -Name "Usage Service Application" -DatabaseServer "SP13\SQL12" 
     -DatabaseName "SP13_UsageService" -UsageService $UsageService
    
  10. Provision State Service Application
  11. New-SPStateServiceDatabase -Name "SP13_StateService" |New-
    SPStateServiceApplication -Name "State Service" | New-
    SPStateServiceApplicationProxy -DefaultProxyGroup
    
  12. Provision Subscription Settings Service Application (required for SharePoint App)
  13. $Account = New-SPManagedAccount
    ##Enter "contoso\SPAppPool" with password on prompt.##
    
    $AppPool = New-SPServiceApplicationPool -Name
     "SP_ServiceApplicationDefaultAppPool" -Account $Account
    
    $App = New-SPSubscriptionSettingsServiceApplication 
     -ApplicationPool $AppPool -Name "Subscription Settings Service" 
     -DatabaseName "SP13_SubscriptionSettingsService"
    
    New-SPSubscriptionSettingsServiceApplicationProxy -ServiceApplication $App
    
  14. Provision App Management Service Application (required for SharePoint App)
  15. $Account = Get-SPManagedAccount "Contoso\SPAppPool"
    ## If not found, try creating a new one via "New-SPManagedAccount" ##
    
    $AppPool = New-SPServiceApplicationPool -Name 
      "AppMgmtServiceAppPool" -Account $Account
    
    $App = New-SPAppManagementServiceApplication 
      -ApplicationPool $AppPool -Name "App Management Service Application"
      -DatabaseName "SP13_AppMgmtService"
    
    New-SPAppManagementServiceApplicationProxy -ServiceApplication $App
    
  16. (Optional) Provision Search Service Application
    Important: Not recommended for dev environment. Search Service Application will make the single-server dev environment very very slow.  It is not recommended to configure and run Search Service Application for dev environment.
    $AppPool = Get-SPServiceApplicationPool 
     -Identity "SP_ServiceApplicationsDefaultAppPool"
    
    $ServerName = (Get-ChildItem env:computername).Value
    $ServiceAppName = "Search Service"
    $DatabaseName = "SP13_SearchService"
    Start-SPEnterpriseSearchServiceInstance $ServerName
    Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $ServerName
    
    $App = New-SPEnterpriseSearchServiceApplication -Name $ServiceAppName 
     -ApplicationPool $AppPool -DatabaseName $DatabaeName
    New-SPEnterpriseSearchServiceApplicationProxy -Name "$ServiceAppName Proxy" 
     -SearchApplication $App
    
    $clone = $App.ActiveTopology.Clone()
    $Instance = Get-SPEnterpriseSearchServiceInstance
    
    New-SPEnterpriseSearchAdminComponent -SearchTopology $clone 
     -SearchServiceInstance $Instance
    
    New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone 
     -SearchServiceInstance $Instance
    
    New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone
     -SearchServiceInstance $Instance
    
    New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone 
     -SearchServiceInstance $Instance
    
    New-SPEnerpriseSearchIndexComponent -SearchTopology $clone 
     -SearchServiceInstance $Instance
    
    New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone
     -SearchServiceInstance $Instance
    
    $clone.Activate()
    
    
  17. Configure the Outgoing e-mail server information
    1. In Central Admin site, go to System Settings
    2. Click Configure outgoing e-mail settings
    3. On the Outgoing E-Mail Settings page
      1. Outbound SMTP server = dc01.contoso.edu
      2. From address = "sharepoint@contoso.edu"
  18. Create a Web Application
    1. Central Admin --> Application Management --> Web Application --> Manage Web Applications
    2. Click New
    3. Under Create New Web Application
      1. Select "Create a new IIS web site" 
        1. Name = SharePoint - 80
        2. Port = 80
        3. Path = (default) C:\inetpub\wwwroot\wss\VirtualDirectories\80
      2. Allow Anonymous = No
      3. Use Secure Sockets Layer (SSL) = No
      4. Enable Windows Authentication = checked
        1. Integrated Windows Authentication (checked) = NTLM
      5. Default Sign In Page (selected)
      6. Url = http://sp13:80/
      7. Zone = Default
      8. Create a new application pool
        1. application pool name = SharePoint - 80
        2. security account for this application pool
          1. Configurable
            1. contoso\SPAppPool
      9. Database Server = SP13\SQL12
      10. Database Name = SP13_Content
      11. Database authentication = Windows authentication (recommended)
      12. Service Application Connections = default
      13. Click [OK].
  19. Create Managed Metadata Service Application
    1. Central Admin --> Manage Service Application 
    2. Click [New]
    3. Click "Managed Metadata Service Application"
      1. Name = "Managed Metadata Service"
      2. Database Server = "SP13\SQL12"
      3. Database Name = "SP13_ManagedMetadataService"
      4. Windows Authentication (checked)
      5. New application pool name = "ManagedMetadataServiceAppPool"
      6. Security Account = configurable (checked): contoso\SPAppPool.
    4. Click [OK].
  20. Create User Profile Service Application
    1. Managed Metadata Service Application instance above (#15) is prerequisite to the User Profile Service Application. Make sure Managed Metadata Service Application has been created.
    2. Reboot SP13 (recommended) or restart SharePoint Timer Services.
    3. Log on as Contoso\SPFarm. Important!
    4. Right-click on IE and run IE as local admin. 
    5. Go to http://sp13:13311.
    6. Go to Manage Services on Server.
    7. Click "Start" link on User Profile Service. This should start really quick.
    8. Go to Manage Service Applications.
    9. Click [New] from the ribbon menu. 
    10. Select "New User Profile Service Application".
      1. Name = "User Profile Service Application"
      2. New app pool name = "UserProfileServiceAppPool"
      3. security account for app pool = configurable (Contoso\SPFarm)
      4. Profile Database:
        1. Database Server = SP13\SQL12
        2. Database Name = SP13_UserProfileService_Profile
        3. Database authentication = Windows auth
      5. Synchronization Database:
        1. Database Server = SP13\SQL12
        2. Database Name = SP13_UserProfileService_Sync
        3. Database authentication = Windows auth
      6. Social Tagging Database:
        1. Database Server = SP13\SQL12
        2. Database Name = SP13_UserProfileService_Social
        3. Database authentication = Windows auth
      7. Profile Synchronization Instance = SP13
      8. My Site Host URL = (skip this for now)
      9. My Site Managed Path = (skip this for now)
      10. Site Naming Format = User name (resolve conflicts by using domain_username)
      11. Default Proxy Group = Yes
      12. Click [Create].
    11. After successful creation of User Profile Service Application, reboot SP13 (recommended) or at least restart SharePoint Timer Service.
    12. Log on to DC01 server as domain admin.
    13. Assign "Replicating Directory Change" permission to contoso\spfarm account.
      1. Run "Active Directory Users and Computers" on DC01 as domain admin (Contoso\Administrator).
      2. Right-click the domain (contoso.edu) and select Delegate Control.
      3. Click [Next]. Click [Add]. 
      4. Enter SPFarm. Click [Check Names]. Click [OK].
      5. Click [Next]. 
      6. On the "Tasks to Delegate" page, select "Create a custom task to delegate" radio button. Click [Next].
      7. On the "Active Directory Object Type" page, 
        1. Select "This folder, existing objects in this folder, and creation of new objects in this folder" radio button. Click [Next].
      8. On the "Permissions" page, scroll down and select "Replicating Directory Changes". Click [Next]. Click [Finish].
    14. Log on to SP13 server as Contoso\SPFarm.
    15. Run IE as local admin. Go to "http://sp13:13311".
    16. Go to Manage Services on Server.
    17. Locate User Profile Synchronization Service. Click Start link.
    18. Enter SPFarm's password. Click OK.
    19. User Profile Synchronization Service is a pre-requisite for User Profile Service Application. Without it, User Profile Service Application cannot have any connections to the AD at all. 
    20. If User Profile Synchronization Service is stuck in Starting
      1. Restart SharePoint Timer Service and check again. Repeat a few times.
      2. We have to make sure both "User Profile Service" and "User Profile Synchronization Service" are in Started status. If "User Profile Synchronization Service" is stopped, start it. Enter credential of "contoso\spfarm" account on the next page. It may take several minutes to start the User Profile Sync Service.
        If it is stuck on Starting, restart the SharePoint Timer Service or Reboot (recommended). If still stuck on "Starting" status,  use the following PowerShell to stop the service and repeat this step to start it. Often enough, it takes more than a couple of trials of start - stop - start - stop until it finally starts. (source)
        #First, get GUID of the User Profile Synchronization Service 
        Get-SPServiceInstance | Where { $_.TypeName -like "User Profile Synchronization*"} | Select TypeName, Id
        #Then copy the Id value and paste it on the next command.
        Stop-SPServiceInstance [id-value]
      3. If all repeated efforts fail, we need to delete User Profile Service Application and start over its configurations.
    21. If User Profile Synchronization Service successfully started,  go to "Manage Profile Service" page by clicking "User Profile Service Application" in Service Applications Page and start setting up Profile Sync Settings.
    22. Configure SharePoint Profile Sync
      1. Go to "Manage Service Application"
      2. Click "User Profile Service Application"
      3. On "Manage Profile Service" page, click "Configure Synchronization Connections" and "Create New Connection".
        1. Connection Name = Contoso_AD
        2. Type = Active Directory
        3. Forest Name = contoso.edu
        4. Connection Settings
          1. Auto discover domain controller (checked)
          2. Authentication Provider Type = Windows Authentication
          3. Account name = contoso\spfarm
          4. port = 389
        5. Containers: Users directly below CONTOSO
      4. Click [OK].
      5. Go to "Manage Profile Service" page.
        1. Go to "Manage User Properties".
        2. Edit mapped attributes of the following:
          1. Work Email
            1. Direction = Import
            2. Attribute = mail
          2. Picture (optional)
            1. Direction = Export
            2. Attribute = thumbnailPhoto
            3. Description: Upload a photo to help others easily recognize you at meetings and events. Your picture will show up for contacts in Outlook and Lync as well as in different parts of SharePoint, but it may take a day or so to sync your changes with all of these systems.
          3. SIP Address (optional)
            1. Direction = Import
            2. Attribute = msRTCSIP-PrimaryUserAddress
        3. Find "Work Email". Click and Select [Edit].
        4. Go to "Add New Mapping" section 
          1. Manually enter Attribute = mail  and click [Add].
          2. Click [OK]. This will map mail field in AD to Work Email in User Profile Synchronization Properties.
      6. Go to Manage Profile Service page. 
        1. Click "Start Profile Synchronization"
        2. Choose "Start Full Synchronization". Click [OK].
    23. Go to "Services on Server". 
    24. If "User Profile Synchronization Service" is not in "Started" status, Click [Start] link on "User Profile Synchronization Service".
    25. Enter password for selected account name (contoso\SPFarm).
    26. Wait for ~5 min. Monitor activities on Task manager until activities slows down. 
    27. Check if status of "User Profile Synchronization Service" is in "Started".
  21. Create a new web application
    1. Create a new IIS web site: Name = SharePoint - 80
    2. Port = 80
    3. Take all default options. Click OK.
  22. Create a new Site Collection using URL http://sp13. 
  23. Install and hMailServer on DC01 server and add new domain for contoso.edu. Set up email accounts for spfarm and other SharePoint users in the active directory.
  24. Install and set up email client like Mozilla Thunderbird to test email accounts.
  25. Install Visual Studio as needed on SharePoint server.

Tuesday, December 29, 2015

WEBCONFIG.ACCSRV.XML does not have element "configuration/configSections/sectionGroup[@name='SharePoint']" or it is invalid

I recently updated SharePoint 2013 environment using the December 2015 CU packages and ran into an error. There are two (2) SharePoint 2013 servers in the environment. One Web-Front-End SharePoint Server and one Service Application SharePoint Server. On the Service Application Server, the following error message appeared during step 8 of SharePoint Products Configuration Wizard, which I ran after installing all December 2015 CU successfully.

Configuration Failed
...
Failed to install the application content files.
An exception of type System.IO.InvalidDataException was thrown. Additional exception information: The web configuration file, C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\config\WEBCONFIG.ACCSRV.XML, does not have element "configuration/configSections/sectionGroup[@name='SharePoint']" or it is invalid.

First I stopped Access Database Service 2010 and Access Services from the Application Service Server and then ran the Config Wizard again. It did not make a difference.

Then I stopped all services except "SharePoint Server Search" on the Application Service Server and ran the Config Wizard. It completed without error only then.

The following are the list of services I stopped on the Application Service Server.
  • Access Database Service 2010
  • Access Services
  • App Management Service
  • Business Data Connectivity Service
  • Central Administration
  • Claims to Windows Token Service
  • Distributed Cache
  • Document Conversions Launcher Service
  • Document Conversions Load Balancer Service
  • Excel Cacluation Services
  • Lotus Notes Connector (was never turned on)
  • Machine Translation Service (was never turned on)
  • Managed Metadata Web Service
  • Microsoft SharePoint Foundation Incoming E-Mail
  • Microsoft SharePoint Foundation Sandboxed Code Service
  • Microsoft SharePoint Foundation Subscription Settings Service
  • Microsoft SharePoint Foundation Web Application
  • Microsoft SharePoint Foundation Workflow Timer Service
  • PerformancePoint Service
  • PowerPoint Conversion Service
  • Search Host Controller Service
  • Search Query and Site Settings Service
  • Secure Store Service
  • User Profile Service
  • User Profile Synchronization Service
  • Visio Graphics Service
  • Word Automation Services
  • Work Management Service

Also, the lesson I learned was that in SharePoint 2013, it would be best to turn on only the absolutely necessary services or service applications and turn off the ones if they are not absolutely necessary for the sake of the best predictable results in patch installation. 

Saturday, September 12, 2015

SharePoint 2013 + Windows Server 2012 R2 Pre-Requisite Install (Part 2)

When running Setup.exe from SharePoint 2013 install media, we would experience the feared "Prerequisite Missing error message" like below.


There are 10 files to download and install with some care to pass this check successfully. In fact, it is a little bit tricky to perform this pre-requisite installation successfully the first time.


  1. On the SharePoint server, create a folder, "C:\pre".
  2. Download the 10 files below and save them to "C:\pre" folder.
    1. Windows Management Framework 3.0
      http://www.microsoft.com/en-us/download/details.aspx?id=34595
    2. SQL Server 2008 R2 SP1 Native Client
      http://download.microsoft.com/download/9/1/3/9138773A-505D-43E2-AC08-9A77E1E0490B/1033/x64/sqlncli.msi
    3. Microsoft WCF Data Serivces 5.0
      http://download.microsoft.com/download/8/F/9/8F93DBBD-896B-4760-AC81-646F61363A6D/WcfDataServices.exe
    4. Microsoft WCF Data Services 5.6 (To avoid overwrite, rename this download to WcfDataServices56.exe)
      http://download.microsoft.com/download/1/C/A/1CAA41C7-88B9-42D6-9E11-3C655656DAB1/WcfDataServices.exe
    5. Microsoft Information Protection and Control Client
      http://download.microsoft.com/download/9/1/D/91DA8796-BE1D-46AF-8489-663AB7811517/setup_msipc_x64.msi
    6. Microsoft Sync Framework Runtime version 1.0 SP1 (64-bit)
      http://download.microsoft.com/download/E/0/0/E0060D8F-2354-4871-9596-DC78538799CC/Synchronization.msi
    7. Windows Identity Extensions
      http://download.microsoft.com/download/0/1/D/01D06854-CA0C-46F1-ADBA-EBF86010DCC6/r2/MicrosoftIdentityExtensions-64.msi
    8. Windows Identity Foundation (KB974405)
      http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.1-KB974405-x64.msu 

      Windows Identity Foundation has been integrated into .NET 4.5. No need to install it.
    9. Windows Server AppFabric
      http://download.microsoft.com/download/A/6/7/A678AB47-496B-4907-B3D4-0A2D280A13C0/WindowsServerAppFabricSetup_x64.exe
    10. Windows Server AppFabric Cumulative Update 1 (KB2671763)
      http://download.microsoft.com/download/7/B/5/7B51D8D1-20FD-4BF0-87C7-4714F5A1C313/AppFabric1.1-RTM-KB2671763-x64-ENU.exe
  3. We are supposed to install prerequisite files via "PrerequisiteInstaller.exe" with specific switches for each downloaded file. In my case, this didn't work too well. You can try the following Powershell scripts, but if you have problems, there is a manual way to install the prerequisite files. I'll go over it in #4.

    PowerShell Script to run prerequisite install altogether:.
    $path = "C:\pre"
    
    Start-Process "E:\PrerequisiteInstaller.exe" –ArgumentList "/SQLNCli:$Path\sqlncli.msi /IDFX:$Path\Windows6.1-KB974405-x64.msu /IDFX11:$Path\MicrosoftIdentityExtensions-64.msi /Sync:$Path\Synchronization.msi /AppFabric:$Path\ WindowsServerAppFabricSetup_x64.exe /KB2671763:$Path\AppFabric1.1-RTM-KB2671763-x64-ENU.exe /MSIPCClient:$Path\setup_msipc_x64.msi /WCFDataServices:$Path\WcfDataServices.exe /WCFDataServices56:$Path\WcfDataServices56.exe"
    
    
    Prerequisite Files (Beware of the last one: AppFabric)

  4. It turns out that all prerequisite files can be installed manually via "Shift + Right Click" and "Run as Administrator", except for the two AppFabric install files.

    "WindowsServerAppFabricSetup_x64.exe"
    "AppFabric1.1-RTM-KB2671763-x64-ENU.exe"

    To install AppFabric, make sure to uninstall AppFabric from "Add Remove Programs" window from previous failed attempt if any.  Reboot the server if uninstall was performed and run the following in Command Prompt (in admin mode).
    C:\Pre\WindowsServerAppFabricSetup_x64.exe /i CacheClient,CachingService,CacheAdmin /gac
    
    

    (Basically, the above switches are what the "PrerequisiteInstaller.exe" tried to implement when the setup file was run under PrerequisiteInstaller.exe)
  5. Let it run for a couple of minutes. Check with TaskManager and "Add/Remove Programs" to confirm AppFabric 1.1's installation. Then reboot the server, and then run "AppFabric1.1-RTM-KB2671763-x64-ENU.exe" with "Run as Admin". This should be the end of SharePoint 2013's prerequisite installation, and you  should be able to proceed with the SharePoint 2013 setup.

SharepPoint 2013 + Windows Server 2012 R2 Pre-requisite Install (Part 1)

This will save some time when building a SharePoint 2013 dev envionrment or when setting up SharePoint server in general.
Import-Module ServerManager

Add-WindowsFeature NET-WCF-HTTP-Activation45, NET-WCF-TCP-Activation45, NET-WCF-Pipe-Activation45

Add-WindowsFeature Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,WEB-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support,AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer


Note: The third command is a single line. Remove any line-feed / carriage-return before running the script in PowerShell.