Share via


SharePoint 2013: Download and Install Prerequisites on Windows Server 2012 with PowerShell

Introduction

Download the PowerShell Scripts from the TechNet Gallery - Download and Install SharePoint 2013 Prerequisites on Windows Server 2012

The intent of these scripts is to assist those who are required to perform an 'offline' Prerequisite Installation of SharePoint 2013 on Windows Server 2012. It is also for those who wish to learn more about the Prerequisite installation process and/or perform the Prerequisite installation manually. It is intended that you execute each script in order. The reasons for breaking up the scripts into three different scripts are explained in each section below.

There are three scripts within the .zip file download:

  1. Install-SP2013RolesFeatures.ps1
  2. Download-SP2013PreReqFiles.ps1
  3. Install-SP2013PreReqFiles.ps1

Please read this documentation completely prior to using my scripts. There is a lot of insight into the PrerequisiteInstaller.exe process that you should know in these instructions.

NOTE THAT THESE SCRIPTS APPLY ONLY TO WINDOWS SERVER 2012. DO NOT USE THEM ON A WINDOWS SERVER 2008 R2 SP1 SERVER.

For complete insight into the potential issues and solutions addressed by these scripts related to installing the SharePoint 2013 Prerequisites on Windows Server 2012 in an offline environment see Install SharePoint 2013 Prerequisites Offline or Manually on Windows Server 2012 - A Comprehensive Guide on the TechNet Wiki

Step 1: Install-SP2013RolesFeatures.ps1

This script installs all of the necessary Windows Server 2012 Roles/Features to prepare for a SharePoint 2013 installation. This script was tested and executed on a freshly installed Windows 2012 server after the adding it to my domain and configuring the network adapter with a static IP address. Note that the Roles/Features installed are exactly the same ones Microsoft uses in their Prerequisite install app (in fact, in the same order they execute the Add-WindowsFeature cmdlet). This script supports installing the Roles/Features 'Online' with an Internet connection and 'Offline' without an Internet connection.

Windows Server 2012 Environment Assumptions:

This script assumes (and does not check) that the following Windows Server 2012 Features are installed (they should installed be by default in Windows Server 2012):

  • .NET Framework 4.5 Features (NET-Framework-45-Features)
  • .NET Framework 4.5 Features > .NET Framework 4.5 (NET-Framework-45-Core)
  • Windows PowerShell (PowerShellRoot)-Windows PowerShell > Windows PowerShell 3.0 (PowerShell)

Please be sure that the RTM versions (i.e. no CTP versions) are installed in your environment prior to running this script.

Are you installing the Roles/Features 'Online' or 'Offline'?

  • If your server is 'Online' and you use the PrerequisiteInstaller.exe (i.e. out of the box), it will execute a PowerShell script to install the necessary Roles/Features to configure Windows Server 2012 for SharePoint 2013. Part of the (PowerShell) Add-WindowsFeature installation installs the NET-Framework-Core feature which is .NET 3.5. This installation requires binaries and other files that are not included by default in Windows Server 2012. This requires Windows Update to download/install these files and an Internet connection. There is no way (that I have found - please correct me if I am wrong) around this. You must be 'Online' for the "Configuring Application Server Role, Web Server  (IIS Role)" phase of the PrerequisiteInstaller.exe to successfully work.
  • If your server is 'Offline' the "Configuring Application Server Role, Web Server  (IIS Role)" phase of the PrerequisiteInstaller.exe will not work - this also means that manually installing the Roles/Features will not work (without the Windows Server 2012 installation media - keep reading). You'll need to do this manually. Even if you are 'Online', installing the Windows Server 2012 Roles/Features for SharePoint 2013 is faster if you install them 'Offline' as you bypass the Windows Update download part of the process. 
    • If you intend on using this script to install the Windows 2012 Roles/Features for SharePoint 2013 'Offline', you need to have downloaded the Windows Server 2012 installation media from MSDN, TechNet or Volume Licensing/Software Assurance etc. and have it available locally (either mounted, locally copied, or accessible via a UNC path) for this script to work.

Why did I write this script?

  • To document and share the specific Roles/Features required by SharePoint 2013 and to demonstrate how to install them via PowerShell using the Add-WindowsFeature cmdlet.
  • To isolate the installation of the required Windows Server 2012 Roles/Features for SharePoint 2013. After you install the Roles/Features, your server will require a reboot. This script will prompt you to reboot. 
  • To enable individuals to install the specific Roles/Features required by SharePoint 2013 'Offline'.

Procedure:

  1. Download .zip file containing my scripts and extract the .ps1 files to c:\powershellscripts (or another directory of your choosing)
  2. Run PowerShell as Administrator (you can do this from the Start Screen - right click PowerShell and select "Run as Administrator"
  3. Ensure you have set your PowerShell execution policy to Remote-Signed (you can change it later if you need to)
  4. Run this script: c:\powershellscripts\Install-SP2013RolesFeatures.ps1) 
    1. When you run the script, it will prompt you to decide if you are installing the Roles/Features 'Online' or 'Offline'. If you select 'Online' your server must have an Internet Connection. In this case, Windows Update will be used to download then install binaries and other files related to the installation of .NET 3.5. If you select 'Offline', the script will prompt you for the location of your Windows Server 2012 installation media. The binaries and other files required are included in this media. Enter the path (without a trailing slash) to the 'sources\sxs' folder (for example D:\sources\sxs) of your Windows Server 2012 installation media. This can be a mounted ISO, a local drive or a UNC path. Using the 'Offline' method will install the Roles/Features faster than the 'Online' method. 
    2. The script will prompt you to Reboot your server after the Roles/Features have installed. You can opt in or out, but I recommend that you opt-in and reboot your server as you need to in order for the Windows Features to be configured correctly.

Step 2: Download-SP2013PreReqFiles.ps1

This script downloads the ENGLISH versions of the required Prerequisite files for SharePoint 2013 on Windows Server 2012. It stores them in a directory of your choosing.

Why did I write this script?

  • To download the prerequisite files required by the SharePoint 2013 installer
  • So those who need to install SharePoint 2013 on an 'offline' server that does not have an Internet connection can use the script to download the prerequisite files on a computer that does have an Internet connection. The files can then be copied to the 'offline' server to proceed with the SharePoint 2013 installation. 

Procedure:

  1. Create a local directory where the script can save the SharePoint 2013 Pre-requisite downloads. For example, c:\sp2013downloads.
  2. Run PowerShell as Administrator (you can do this from the Start Screen - right click PowerShell and select "Run as Administrator"
  3. Run this script: c:\powershellscripts\Download-SP2013PreReqFiles.ps1. You will be required to define a path where the script can save the downloaded files. (e.g. c:\sp2013downloads)
  4. Sit back and let the files download.

 

Step 3: Install-SP2013PreReqFiles.ps1

This script utilizes the PrerequisiteInstaller.exe included in the SharePoint 2013 installation media to install the necessary prerequisites for SharePoint 2013 on Windows Server 2012.

Assumptions:

You have downloaded the SharePoint 2013 installation media from MSDN, TechNet or Volume Licensing/Software Assurance etc.

Notes:

  • If you did not run my Install-SP2013RolesFeatures.ps1 script, this script will install the Windows Server 2012 Roles/Features necessary for SharePoint 2013. Just be aware that you'll need to run the script twice. The first run will install the Roles/Features then you'll reboot. The second run is required to install the Prerequisites.
  • I intentionally am NOT running the PrerequisiteInstaller in unattended mode. This way, you'll see the Prerequisite installer screen and see what it is doing. I know there are other ways this can be launched and monitored, however, this is the way I prefer to do it so there is an on-screen indication of what is going on with the installer.

Why did I write this script?

  • To assist those who wish to install the SharePoint 2013 Prerequisites 'offline'
  • To demonstrate how you can install the SharePoint 2013 Prerequisites via PowerShell

There are two different scenarios for how you can use this script

Procedure - Scenario 1:

  • You have already executed Install-SP2013RolesFeatures.ps1 and rebooted your server
  • You have already executed Download-SP2013PreReqFiles.ps1
  1. Copy the SharePoint 2013 installation media files into a local directory on your Windows Server 2012 server. For example, c:\sp2013.
  2. Copy the Prerequisite files into the c:\sp2013\prerequisiteinstallerfiles directory.
  3. Run PowerShell as Administrator (you can do this from the Start Screen - right click PowerShell and select "Run as Administrator"
  4. Run this script: c:\powershellscripts\Install-SP2013PreReqFiles.ps1. You will be required to define a path where to your SharePoint 2013 installation media. (e.g. c:\sp2013). Watch the Prerequisite installer tool install all of the prerequisites.
  5. When the installer is complete, reboot your server prior to installing SharePoint 2013. You should now be able to run the SharePoint 2013 installer, bypassing the Pre-requisite step.

Procedure - Scenario 2:

  • You have NOT executed Install-SP2013RolesFeatures.ps1 and rebooted your server
  • You have already executed Download-SP2013PreReqFiles.ps1
  1. Copy the SharePoint 2013 installation media files into a local directory on your Windows Server 2012 server. For example, c:\sp2013.
  2. Copy the Prerequisite files into the c:\sp2013\prerequisiteinstallerfiles directory.
  3. Run PowerShell as Administrator (you can do this from the Start Screen - right click PowerShell and select "Run as Administrator"
  4. Run this script: c:\powershellscripts\Install-SP2013PreReqFiles.ps1. You will be required to define a path where to your SharePoint 2013 installation media. (e.g. c:\sp2013). On this run, defining the path isn't technically required as it will add the Windows Server 2012 Roles/Features for SharePoint 2013. When the Roles/Features are installed, click Finish and your server will reboot.
  5. After the reboot, when you log in, if the PrerequisiteInstaller launches, close the installer.Prerequisite installer tool. Install all of the prerequisites.
  6. Run this script: c:\powershellscripts\Install-SP2013PreReqFiles.ps1. You will be required to define a path where to your SharePoint 2013 installation media. (e.g. c:\sp2013). Watch the Prerequisite installer tool install all of the prerequisites.
  7. When the installer is complete, reboot your server prior to installing SharePoint 2013. You should now be able to run the SharePoint 2013 installer, bypassing the Pre-requisite step.