Automatically Download All SharePoint Server 2016 Prerequisites

Dan Holme

by Dan Holme on 3/20/2016

Share this:

Article Details

Date Revised:

I'm a big fan of scripting installation of SharePoint servers and farms. Like many SharePoint administrators, I've built a set of PowerShell scripts that I use to deploy SharePoint in my lab environment and at customers. Scripts allow me to deploy more quickly, of course, but more importantly they ensure that farms have been deployed consistently. Plus, because my farms have been installed and configured with scripts, there's a built-in documentation stream.

In this article, I'm going to share one of my PowerShell scripts. This script downloads all of the updates and prerequisites that are necessary to install SharePoint Server 2016 on a server running an out-of-box installation of Windows Server 2012 R2.  There are almost two dozen updates to Windows and prerequisites for SharePoint that must be in place before you can run "setup.exe" for SharePoint.

The good news is that these updates and prerequisites are always the same. So, if you can automate the deployment of these updates and prerequisites, you can ensure your servers are ready for action each and every time you deploy a new SharePoint server in any environment. So updates and prerequisites are prime candidates for scripting. 

This script will download all prerequisites that are required for the installation of SharePoint Server 2016 on Windows Server 2012 R2. It stores prerequisites in two folders:

  • A folder for the updates to Windows Server 2012 R2 that must be applied before you can run PrerequisiteInstaller.exe

I will be uploading a script that applies these updates in the correct order. Until then, please note that the Windows Server 2012 R2 updates must be applied in this order:

  1. KB2919442 (restart required) 
  2. clearcompressionflag.exe 
  3. KB2919355 
  4. KB2932046 
  5. KB2959977 
  6. KB2937592 
  7. KB2938439 
  8. KB2934018

See and for details

    To modify this script for your environment:

    • Create the folders to which updates and prerequisites will be saved
    • Modify the values in the CONFIGURATION BLOCK section
    • Run the script in a PowerShell console (or ISE) launched with the RUN AS ADMINISTRATOR option

    The script is below. You can also download the script from GitHub.

    A shout out to Craig Lussier. His script on TechNet for SharePoint 2013 inspired me several years ago to automate the download of prerequisites, and serves as the basis for this script.

    Pro Tip: Image your baseline SharePoint server

    You can create the perfect, ready-to-deploy SharePoint server by following these steps:

    • Install Windows Server 2012 R2
    • Apply the required updates to Windows Server 2012 R2
    • Run SharePoint's PrerequisiteInstaller.exe to install SharePoint prerequisites
    • Run SharePoint's Setup.exe (but do NOT continue to PSConfig.exe)
    • Create an image or snapshot of the machine

    I will release more scripts to address these steps. Stay tuned.


    If this script might be useful to you, I highly suggest that you WATCH (follow) THE SCRIPT ON GITHUB for updates. You can also FOLLOW ME ON GITHUB for more SharePoint and Active Directory scripts in the near future.
    # Download SharePoint 2016 Prerequisites
    # 1.0
    # 16 March 2016
    # Please provide feedback to Dan Holme
    # [email protected]
    # This script downloads SharePoint 2016 prerequisites that can be
    # later installed by the SharePoint 2016 Prerequisite installer and
    # by addiitonal prerequisite installation scripts.
    # TESTED ON: Windows Server 2012 R2 
    # Should work on Windows Server 2016
    # 1.0      THIS VERSION
    # Based on a script by Craig Lussier ( on TechNet
    # Updated for SharePoint Server 2016
    # Run PowerShell as Administrator
    # -------------------
    # Configure the folders to which updates and prerequisites are saved.
    # These folders must already exist - the script does not create them.
    # The top-level folder in the installation folder tree
    $RootFolder = "C:\SharePointInstall"
    # The folder for prerequisites installed before the Prerequisite Installer
    # There are a number of updates to Windows Server 2012 R2 that must be installed
    # before SharePoint Server 2016's Prerequisite Installer can be run
    $Prereqs1Folder = "$RootFolder\SharePoint_Prerequisites\Windows_Server_2012_R2_Updates"
    # The folder for prerequisites used by the Prerequisite Installer
    $Prereqs2Folder = "$RootFolder\SharePoint_Prerequisites\PrerequisiteInstaller"
    # -----------------------
    # ----------------------------------------------------------------
    # Download details
    # Do not change unless Microsoft changes the downloads themselves
    # ----------------------------------------------------------------
    # Specify download url's for SharePoint 2016 prerequisites
    $Downloads = @{
                # Microsoft SQL Server 2012 Native Client 64-bit edition – ENU\x64\sqlncli.MSI -
                "" = "$Prereqs2Folder\sqlncli-2012.msi";
                # Microsoft ODBC Driver 11 for SQL Server
                "" = "$Prereqs2Folder\msodbcsql.msi";
                # Microsoft Sync Framework Runtime v1.0 SP1 (x64)
                "" = "$Prereqs2Folder\Synchronization.msi"; 
                # Windows Server App Fabric
                "" = "$Prereqs2Folder\WindowsServerAppFabricSetup_x64.exe"; 
                # Windows Identity Foundation (KB974405)
                "" = "$Prereqs2Folder\Windows6.1-KB974405-x64.msu"; 
                # Microsoft Identity Extensions
                "" = "$Prereqs2Folder\MicrosoftIdentityExtensions-64.msi";
                # Microsoft Information Protection and Control Client
                # MSI version (does not satisfy Prerequisite Installer): 
                "" = "$Prereqs2Folder\setup_msipc_x64.exe";
                # Microsoft WCF Data Services 5.6 required for SharePoint 2013 SP1
                "" = "$Prereqs2Folder\WcfDataServices56.exe"; 
                # .NET Framework 4.6 Offline Installer
                "" = "$Prereqs2Folder\NDP46-KB3045557-x86-x64-AllOS-ENU.exe";
                # Cumulative Update Package 7 for AppFabric 1.1 for Windows Server
                "" = "$Prereqs2Folder\AppFabric-KB3092423-x64-ENU.exe";
                # Visual C++ Redistributable for Visual Studio 2012 Update 4
                "" = "$Prereqs2Folder\vcredist_x64.exe";
                # Visual C++ Redistributable for Visual Studio 2015
                "" = "$Prereqs2Folder\vc_redist.x64.exe"
                # Silverlight
                "" = "$Prereqs3Folder\Silverlight_x64.exe";
                # Exchange Web Services Managed API, version 1.2
                "" = "$Prereqs3Folder\EwsManagedApi.msi";
                # Update for Windows 8.1 for x64-based Systems (KB2919442)
                # a prerequisite for the Windows Server 2012 R2 Update
                "" = "$Prereqs1Folder\Windows8.1-KB2919442-x64.msu";
                # Windows Server 2012 R2 Update (KB2919355)
                # Windows Server 2012 R2 clearcompressionflag.exe
                "" = "$Prereqs1Folder\clearcompressionflag.exe";
                # Windows Server 2012 R2 Windows8.1-KB2919355-x64.msu 
                "" = "$Prereqs1Folder\Windows8.1-KB2919355-x64.msu";
                # Windows Server 2012 R2 Windows8.1-KB2932046-x64.msu
                "" = "$Prereqs1Folder\Windows8.1-KB2932046-x64.msu";
                # Windows Server 2012 R2 Windows8.1-KB2934018-x64.msu
                "" = "$Prereqs1Folder\Windows8.1-KB2934018-x64.msu";
                # Windows Server 2012 R2 Windows8.1-KB2937592-x64.msu
                "" = "$Prereqs1Folder\Windows8.1-KB2937592-x64.msu";
                # Windows Server 2012 R2 Windows8.1-KB2938439-x64.msu
                "" = "$Prereqs1Folder\Windows8.1-KB2938439-x64.msu";
                # Windows Server 2012 R2 Windows8.1-KB2959977-x64.msu
                "" = "$Prereqs1Folder\Windows8.1-KB2959977-x64.msu";
    # Import Required Modules: BITS is used for file transfer
    Import-Module BitsTransfer 
    function DownloadFiles() 
        Write-Host ""
        Write-Host "====================================================================="
        Write-Host "             Downloading SharePoint 2016 Prerequisites" 
        Write-Host "====================================================================="
        $ReturnCode = 0 
        $Downloads.GetEnumerator() | ForEach { 
            $DownloadURL = $_.get_key()
            $Filespec = $_.get_value()
            # Get the file name based on the portion of the file path after the last slash 
            $FilePath = Split-Path $Filespec
            $FileName = Split-Path $Filespec -Leaf
            Write-Host "DOWNLOADING: $FileName"
            Write-Host "       FROM: $DownloadURL"
            Write-Host "         TO: $FilePath"
                # Check if file already exists 
                If (!(Test-Path "$Filespec")) 
                    # Begin download 
                    Start-BitsTransfer -Source $DownloadURL -Destination "$Filespec" -DisplayName "Downloading `'$FileName`' to $FilePath" -Priority High -Description "From $DownloadURL..." -ErrorVariable err 
                    If ($err) {Throw ""} 
                    Write-Host "     STATUS: Downloaded"
                    Write-Host "     STATUS: Already exists. Skipping." 
                $ReturnCode = -1
                Write-Warning " AN ERROR OCCURRED DOWNLOADING `'$FileName`'" 
                Write-Error   $_
        return $ReturnCode 
    $rc = DownloadFiles 
    if($rc -ne -1)
        Write-Host ""
        Write-Host "DOWNLOADS ARE COMPLETE."

    Topic: Deployment

    Sign in with

    Or register

    • Is it possible to get all of the pieces and parts for prereqs/updates and download for offline install. My library has high speed download where as my home where I do my studies has a slow connection about twice as fast as a dial-up connection. I have Windows Server 2016 up and running in virtual box and have SQL Server 2016 and SharePoint Server 2016 iso images (not installed).
    • Works like a charm!