Use PowerShell: build a redist folder to install Dynamics CRM 2016 without an internet connection

We’ve had several customers ask about an updated PowerShellscript that would download the Dynamics 2016 pre-requisites and put them in to a folder for installations without internet access.  Since the previous two versions there's been a change to the files required in 2016, so with a few tweaks and a little testing, we have a script to paste in to PowerShell and create our own CRM 2016 Redist folder with all the pre-requisite files.

Usually you find PowerShell scripts downloadable as PS1 files, for the sake of safety I’ve provided it as text as well as a txt download so you can review the script it before running it in PowerShell.  With that in mind, this script can be simply copied and pasted into PowerShell so you can quickly build your redist folder.

Instructions for use:

  1. Open PowerShell on the computer you have internet access on
  2. Copy the script below top to bottom (from the “#begin script” to the “#end script”) – NOTE you may need to edit your language code in the script if you are not installing the EN-US language
  3. Paste it right into PowerShell – if it doesn’t execute hit enter to run the “Create-CRM2016Redist” function
  4. This will pop up a folder picker, pick a folder and press OK
  5. After you press Ok, the script will create a new Redist folder in the destination you’ve selected it will then proceed to create the directory structure (11 Folders), then download 24 files, this should total about 216MB of disk space when it’s all done.
  6. Finally, once it has completed, copy the redist folder to the install folder containing: Server, Client, EmailRouter, and BIDSExtensions folders
  7. When you’re done copying your install folder should look like the graphic below:

Download the PowerShell Script as a .txt file.

#begin Script 
#Function to Show an Open Folder Dialog and return the directory selected by the user. 
function Read-FolderBrowserDialog([string]$Message, [string]$InitialDirectory) 
    $app = New-Object -ComObject Shell.Application 
    $folder = $app.BrowseForFolder(0, $Message, 0, $InitialDirectory) 
    if ($folder) { return $folder.Self.Path } else { return '' } 
#download pre-req function, also creates the folders 
function dlPreReq($root, $folderName, $fileName, $url)
  $fldr = Join-Path -Path $root -Child $folderName
  $dest = Join-Path -Path $fldr -Child $fileName
  #create folder if it doesnt exist 
  if((Test-Path -Path $fldr) -ne $True)
    New-Item -Path $fldr -ItemType directory | out-null
  Write-Host ("Downloading {0} to path: {1} " -f $fileName, $fldr)
  $wc = New-Object
#download each pre-req 
function Create-CRM2016Redist()
  $linkRoot = ""
  $langCode = "ENU" 
  $LHex = 0x409 #must match above langCode
  $folderRoot = (Read-FolderBrowserDialog "Pick the location to create the Dynamics CRM 2013 redist folder") #folder root
  if(($folderRoot.length) -gt 0)
    $fr = Join-Path -Path $folderRoot -Child "Redist"
    dlPreReq $fr dotNETFX "NDP452-KB2901907-x86-x64-AllOS-ENU.exe" "$($linkRoot)328855&clcid=$($LHex)"
    dlPreReq $fr WindowsIdentityFoundation Windows6.0-KB974405-x86.msu "$($linkRoot)190775&clcid=$($LHex)"
    dlPreReq $fr WindowsIdentityFoundation Windows6.0-KB974405-x64.msu "$($linkRoot)190771&clcid=$($LHex)"
    dlPreReq $fr WindowsIdentityFoundation Windows6.1-KB974405-x86.msu "$($linkRoot)190781&clcid=$($LHex)"
    dlPreReq $fr WindowsIdentityFoundation Windows6.1-KB974405-x64.msu "$($linkRoot)190780&clcid=$($LHex)"
    dlPreReq $fr SQLNativeClient sqlncli_x64.msi "$($linkRoot)178252&clcid=$($LHex)"
    dlPreReq $fr SQLSharedManagementObjects SharedManagementObjects_x64.msi "$($linkRoot)293644&clcid=$($LHex)"
    dlPreReq $fr SQLSystemCLRTypes SQLSysClrTypes_x64.msi "$($linkRoot)293645&clcid=$($LHex)" 
    dlPreReq $fr ReportViewer "ReportViewer.msi" "$($linkRoot)390736&clcid=$($LHex)"
    dlPreReq $fr SQLExpr SQLEXPR_x86_$langCode.exe "$($linkRoot)403076&clcid=$($LHex)" 
    dlPreReq $fr SQLExprRequiredSp SQLEXPR_x86_$langCode.exe "$($linkRoot)403077&clcid=$($LHex)"
    dlPreReq $fr SQLCE SSCERuntime_x86-$langCode.exe "$($linkRoot)253117&clcid=$($LHex)"
    dlPreReq $fr SQLCE SSCERuntime_x64-$langCode.exe "$($linkRoot)253118&clcid=$($LHex)"
    dlPreReq $fr MSI45 Windows6.0-KB942288-v2-x86.msu "$($linkRoot)139108&clcid=0x409"
    dlPreReq $fr MSI45 Windows6.0-KB942288-v2-x64.msu "$($linkRoot)139110&clcid=0x409"    
    dlPreReq $fr VCRedist vcredist_x86.exe "$($linkRoot)402042&clcid=$($LHex)"
    dlPreReq $fr VCRedist vcredist_x64.exe "$($linkRoot)402059&clcid=$($LHex)"
    dlPreReq $fr VCRedist10 vcredist_x86.exe "$($linkRoot)404261&clcid=$($LHex)"
    dlPreReq $fr VCRedist10 vcredist_x64.exe "$($linkRoot)404264&clcid=$($LHex)"
    dlPreReq $fr IDCRL wllogin_32.msi "$($linkRoot)194721&clcid=$($LHex)"
    dlPreReq $fr IDCRL wllogin_64.msi "$($linkRoot)194722&clcid=$($LHex)"
    dlPreReq $fr WindowsIdentityFoundationExtensions "MicrosoftIdentityExtensions-64.msi" ""
    dlPreReq $fr Msoidcrl msoidcli_32bit.msi "$($linkRoot)317650&clcid=$($LHex)"
    dlPreReq $fr Msoidcrl msoidcli_64bit.msi "$($linkRoot)317651&clcid=$($LHex)"    
    write-host "No folder selected, operation was aborted. Run Create-CRM2016Redist to retry."

#kick off the script 

#End Script 
Comments (3)

  1. Jon Capps says:

    Thanks Sean

  2. Shai says:

    Very Nice , and work great.
    Now , Can we have scripts to install new server/servers from scratch .
    1 single server with everything to run dev/test.
    3-4 Servers with AD, SQL , Front-end Server , Back-end Server.
    Build new VMs from scratch (install OS + needed features , Applications)
    Do the same on containers .
    On Premise and on cloud.

    1. @Shai, I don’t have such a script off hand though there are a few floating around on blogs. At one point, when I maintained an onprem environment I had used AutoIt to do some automation but in later years I did almost everything with powershell to automate the process of DCPromo and component installations. You can automate the Dynamics CRM OnPrem Installation using the server installation XML file and a silent installation (Documented in the IG, I may have some xml floating around from many years ago), however automating a 100% from scratch build out of a domain and all machines is a big undertaking and tends to be fragile.

      Regarding containers: Dynamics 365 onprem isn’t using containers at this point and won’t install within them – I’m not sure what the future holds at this point but for now installing the CRM server components inside a container wouldn’t be something supported and I’m fairly certain it wouldn’t work at all in the onprem versions available today.

      For myself, I’ve found the easiest way to quickly spin up Dynamics 365 is by using CRM Online and the admin API to provision an instance for testing.

Skip to main content