SharePoint 2013: Install Prerequisites Offline or Manually on Windows Server 2012 R2

What do I need to successfully install the Prerequisites?

  • A server with the 64-bit Windows Server 2012 R2 installed (Standard or Datacenter edition) upon which you intend to install SharePoint 2013 (in my case I installed it as a Hyper-V guest operating system)
  • SharePoint 2013 installation media
  • Windows Server 2012 R2 installation media

Why is attention to an Offline or Manual Prerequisites installation important?

Out of the box, the Prerequisiteinstaller.exe requires an Internet connection (i.e. the server is ‘Online’) to successfully complete the installation. If you attempt to use the out of the box PrerequisiteInstaller.exe on a Windows 2012 R2 server without an Internet connection, the installation will fail. 


Identifying all the Prerequisites for Windows Server 2012 R2

Here are the Prerequisite items applicable to Windows Server 2012 R2. I am breaking them down into three separate groups of Prerequisites for easy identification in relation to how the PrerequisiteInstaller.exe will identify and install the Prerequisites:
  1. Prerequisites that should be installed by default (among other things, the installer will check for and verify their presence)   
    1. Microsoft .NET Framework 4.5
    2. Windows Management Framework 3.0

  2. Next are the Roles/Features that are required for the “Application Server Role, Web Server (IIS Role)”. It turns out that this is a long list of Roles/Features - 46 in total. Further into this post, I’ll show you how to get this list while the Prerequisites are installing using the out of the box PrerequisiteInstaller.exe. Within an elevated (i.e. Run as Administrator) PowerShell prompt, you can use Get-WindowsFeature to see all of the Roles/Features installed on your server and map the Roles/Features in the table below to the labels used within the Add Roles/Features Windows Wizard.

    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

  3. Prerequisites that must be downloaded and installed:
    1. Microsoft SQL Server 2008 R2 SP1 Native Client
    2. Microsoft Sync Framework Runtime v1.0 SP1 (x64)
    3. Windows Server AppFabric
    4. Cumulative Update Package 1 for Microsoft AppFabric 1.1 for Windows Server (KB2671763)
    5. Windows Identity Foundation (KB974405)
    6. Microsoft Identity Extensions
    7. Microsoft Information Protection and Control Client
    8. Microsoft WCF Data Services 5.0

Prerequisite Installation issues you may encounter in an Offline environment

Issues with the PrerequisiteInstaller.exe when executed Offline


If you run the PrerequisiteInstaller.exe on an offline instance of Windows Server 2012 R2, you’ll experience the error message “The tool was unable to install Application Server Role, Web Server (IIS) Role”:
This tool requires an Internet connection to install Roles/Features and to download/install other Prerequisite files. Above is the first error screen you'll encounter if installing offline. Essentially if you are performing an offline installation using the PrerequisiteInstaller.exe, you won't be able to get any farther than this. 

Issues with using PowerShell to install Roles and Features when executed Offline

Examples you’ll find online will show you PowerShell similar to the following (ensure this is run at an elevated prompt, i.e. Run as Administrator) to manually install the Windows Server 2012 Roles/Features required by SharePoint 2013.
  • This will fail if the Windows Server 2012 R2 server is offline
  • This will not fail if the Windows Server 2012 R2 server is online ( you may need to enable windows update)
Import-Module ServerManager
  
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

The above code is the PowerShell that the PrerequisiteInstaller.exe will execute (in the PowerShell script file indicated in the above section) and it will fail if the server does not have an internet connection. We now know that the reason is Windows Update is required for the installation of the Net-Framework-Features will also install Net-Framework-Core which is .NET 3.5 and this required binaries and other files that are not included in a default Windows Server 2012 R2 installation.
When the above PowerShell is executed in an Offline environment or in case windows update is disabled, the required Roles/Features for Windows Server 2012 R2 are not installed which is the same experience when you execute PrerequisiteInstaller.exe. Here is the error message you can expect to see from PowerShell:


Now this is error message is more useful.
Add-WindowsFeature : The request to add or remove features on the specified server failed.
Installation of one or more roles, role services, or features failed.
The source files could not be downloaded.
Use the “source” option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see
http://go.microsoft.com/fwlink/?LinkId=243077  . Error : 0x800f0906
When you visit the provided link, it says that you need to in some way restore your Windows Server 2012 R2 installation. What!? But this is a fresh, clean and default install. Well it helps to know that the Net-Framework-Core feature is ‘Removed’ by default (you can confirm this at an elevated PowerShell prompt (i.e. Run as Administrator) by executingGet-WindowsFeature and looking at the status of Net-Framework-Core) and this is what the message is referencing – you need to restore this. For completeness, the Net-Framework-Features feature will automatically install the Net-Framework-Core feature. 
The clues to the solution are the following specific items from the error message:
  • "The source files could not be downloaded" – we know this because the server is offline.
  • "Use the 'source' option to specify the location of the files that are required to restore the feature"
  • Error code 0x800f0906.
Open up Internet Explorer and Bing the following: windows server 2012 Error : 0x800f0906.

The first result (when I searched) was titled “Error codes when you try to install the .NET Framework 3.5 in Windows 8 or in Windows Server 2012” and the support article can be found at http://support.microsoft.com/kb/2734782  . The specific resolution to solve our issue is in this support article. We need to re-run our PowerShell command but this time include the –source parameter specifying a specific the location within the Windows Server 2012 installation media. As an easy example, if your Windows Server 2012 installation media (ISO) is mounted to your D: drive, then the path to provide in the –Source parameter is: D:\sources\sxs. Now we know how to install the SharePoint 2013 Roles/Features Prerequisites successfully in an offline Windows Server 2012 environment.

Solutions - Offline and Manual Prerequisite Procedures


Installing the Roles and Features for SharePoint 2013 on Windows Server 2012 R2 Offline with PowerShell

To install the Roles/Features required by SharePoint 2013 on Windows Server 2012 R2 in an offline environment, you need to have access to the Windows Server 2012 R2 installation media.
For the purposes of example, assume you have mounted the Windows Server 2012 R2 installation media (ISO) to the D: drive of the server. Please note that you can also copy the files locally or specify a UNC path where the installation files are stored. You need to specify
Open an elevated PowerShell prompt (i.e. Run as Administrator) and execute the following:
Import-Module ServerManager
  
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 –Source D:\sources\sxs

Your server will require a reboot after running this PowerShell code.

Downloading the SharePoint 2013 Prerequisite files for Offline Installation

SharePoint 2013 requires the following Prerequisites to be installed on Windows Server 2012 prior to installing SharePoint 2013. The following is a complete list of the Prerequisites along with their download links. Please note that .NET 4.5 and Windows Management Framework 3.0 are also prerequisites and have been intentionally omitted from this list as they are both installed by default on Windows Server 2012 R2.
Obviously you need to download these from the Internet. This is the only portion of this deep dive that can’t be done offline. You’ll need to copy/save these into a location accessible to the SharePoint 2013 Prerequisite installer. See the next section for more details regarding their installation.

Installing the Downloaded Prerequisite files for SharePoint 2013 on Windows Server 2012 R2 using PrerequisiteInstaller.exe

For a TechNet reference to the PrerequisiteInstaller.exe and its switches, see http://technet.microsoft.com/en-us/library/ff686793.aspx  .
For the purposes of example, let’s assume the following:
  • You have the SharePoint 2013 installation media copied locally within Windows Server 2012 R2 at c:\sharepoint2013bits.
  • You have copied the downloaded Prerequisite files to the c:\sharepoint2013bits\PrerequisiteInstallerFiles folder. (See the previous section regarding which files to download)
  • As a note – if you have multiple SharePoint 2013 servers to build, you will be better off placing the SharePoint 2013 installation files on a network share. In addition, you should also copy the downloaded prerequisite files to the location specified above within SharePoint 2013 installation media prerequisiteinstallerfiles directory on said network share. This will make your life easier. Although this example uses local paths, UNC paths on a network share are fully supported as long as the logged in user installing the prerequisites has read rights to the UNC network path location.
Based on the scenario outlined above you can execute the following PowerShell code (at an elevated prompt, i.e. Run as Administrator) to install the prerequisites.

Make sure the second line is all on one line. 
$SharePoint2013Path = "c:\sharepoint2013bits"
  
Start-Process "$SharePoint2013Path\PrerequisiteInstaller.exe" –ArgumentList "/SQLNCli:$SharePoint2013Path\PrerequisiteInstallerFiles\sqlncli.msi /IDFX:$SharePoint2013Path\PrerequisiteInstallerFiles\Windows6.1-KB974405-x64.msu /IDFX11:$SharePoint2013Path\PrerequisiteInstallerFiles\MicrosoftIdentityExtensions-64.msi /Sync:$SharePoint2013Path\PrerequisiteInstallerFiles\Synchronization.msi /AppFabric:$SharePoint2013Path\PrerequisiteInstallerFiles\WindowsServerAppFabricSetup_x64.exe /KB2671763:$SharePoint2013Path\PrerequisiteInstallerFiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe /MSIPCClient:$SharePoint2013Path\PrerequisiteInstallerFiles\setup_msipc_x64.msi /WCFDataServices:$SharePoint2013Path\PrerequisiteInstallerFiles\WcfDataServices.exe"
When you execute this the Microsoft SharePoint 2013 Products Preparation Tool will appear. Follow the prompts and your Prerequisites will install.

 Important Note: (I wrote this article specially for this)
 If you installed the above list by double click every installation file you will get this error  message when you start SharePoint installation setup:
 "Windows Server AppFabric is not correctly configured. You Should uninstall Windows server AppFabric     and reinstall it using the SharePoint Products Preparation tool"
72
you can resolve this problem by uninstall Windows server AppFabric and run the following command in PowerShell from setup file location:

.\WindowsServerAppFabricSetup_x64.exe /i CacheClient”,”CachingService”,”CacheAdmin /gac

Wait until AppFabric installation finish then double click on AppFabric1.1-RTM-KB2671763-x64-ENU.exe to install the AppFabric patch. Reboot the server and run SharePoint Installation again, the error message should disappear .