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


Most likely you’ve read Shawn Dieken’s wildly popular article on how to create a redist folder when installing CRM without an internet connection.  Today I was presented with a customer scenario where a server that should have had internet access did not and thus, we had to install without internet access.  No big deal, however after walking through the article I quickly realized this task, while effective, was pretty monotonous and not a lot of fun.  I caught myself thinking “there must be a better way” – and turns out there was and all we needed to do was bring PowerShell into the mix!

With a few lines of code and a little testing, I had a script to paste in to PowerShell and create my very own CRM 2011 Redist folder with all the pre-requisite files.

Usually you find PowerShell scripts downloadable as PS1 files, but sometimes in scenarios like this I find myself just wanting to, copy my script, open PowerShell, Paste, and Go.  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”)
  3. Paste it right into PowerShell – if it doesn’t execute hit enter to run the “Create-CRM2011Redist” 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 system.net.webclient
$wc.downloadFile($url,$dest)
}
#download each pre-req
function Create-CRM2011Redist()
{
$folderRoot = (Read-FolderBrowserDialog "Pick the location to create the Dynamics CRM 2011 redist folder")
if(($folderRoot.length) -gt 0)
{
$folderRoot = Join-Path -Path $folderRoot -Child "Redist"
dlPreReq $folderRoot dotNETFX "dotNetFx40_Full_x86_x64.exe" "http://go.microsoft.com/fwlink/?LinkId=182091&clcid=0x409"
dlPreReq $folderRoot DotNetServicesSDK WindowsAzureAppFabricSDK-x64.msi "http://go.microsoft.com/fwlink/?LinkId=178254&clcid=0x409"
dlPreReq $folderRoot IDCRL wllogin_32.msi "http://go.microsoft.com/fwlink/?LinkId=194721&clcid=0x409"
dlPreReq $folderRoot IDCRL wllogin_64.msi "http://go.microsoft.com/fwlink/?LinkId=194722&clcid=0x409"
dlPreReq $folderRoot MSI45 WindowsServer2003-KB942288-v4-x86.exe "http://go.microsoft.com/fwlink/?LinkID=139114&clcid=0x409"
dlPreReq $folderRoot MSI45 WindowsServer2003-KB942288-v4-x64.exe "http://go.microsoft.com/fwlink/?LinkID=139115&clcid=0x409"
dlPreReq $folderRoot MSI45 Windows6.0-KB942288-v2-x86.msu "http://go.microsoft.com/fwlink/?LinkID=139108&clcid=0x409"
dlPreReq $folderRoot MSI45 Windows6.0-KB942288-v2-x64.msu "http://go.microsoft.com/fwlink/?LinkID=139110&clcid=0x409"
dlPreReq $folderRoot MSI45 WindowsXP-KB942288-v3-x86.exe "http://go.microsoft.com/fwlink/?LinkID=139113&clcid=0x409"
dlPreReq $folderRoot MsoIdCrl msoidcli_32.msi "http://go.microsoft.com/fwlink/?LinkId=221498&clcid=0x409"
dlPreReq $folderRoot MsoIdCrl msoidcli_64.msi "http://go.microsoft.com/fwlink/?LinkId=221500&clcid=0x409"
dlPreReq $folderRoot ReportViewer ReportViewer.exe "http://go.microsoft.com/fwlink/?LinkId=193386&clcid=0x409"
dlPreReq $folderRoot SQLCE SSCERuntime-ENU-x86.msi "http://go.microsoft.com/fwlink/?LinkId=147327&clcid=0x409"
dlPreReq $folderRoot SQLCE SSCERuntime-ENU-x64.msi "http://go.microsoft.com/fwlink/?LinkId=147326&clcid=0x409"
dlPreReq $folderRoot SQLExpr SQLEXPR_x86_ENU.exe "http://go.microsoft.com/fwlink/?LinkId=179623&clcid=0x409"
dlPreReq $folderRoot SQLNativeClient sqlncli_x64.msi "http://go.microsoft.com/fwlink/?LinkId=178252&clcid=0x409"
dlPreReq $folderRoot VCRedist vcredist_x86.exe "http://go.microsoft.com/fwlink/?LinkId=195255&clcid=0x409"
dlPreReq $folderRoot VCRedist vcredist_x64.exe "http://go.microsoft.com/fwlink/?LinkId=195257&clcid=0x409"
dlPreReq $folderRoot WindowsIdentityFoundation Windows5.2-KB974405-x86.exe "http://go.microsoft.com/fwlink/?LinkId=200432&clcid=0x409"
dlPreReq $folderRoot WindowsIdentityFoundation Windows5.2-KB974405-x64.exe "http://go.microsoft.com/fwlink/?LinkId=200430&clcid=0x409"
dlPreReq $folderRoot WindowsIdentityFoundation Windows6.0-KB974405-x86.msu "http://go.microsoft.com/fwlink/?LinkId=190775&clcid=0x409"
dlPreReq $folderRoot WindowsIdentityFoundation Windows6.0-KB974405-x64.msu "http://go.microsoft.com/fwlink/?LinkId=190771&clcid=0x409"
dlPreReq $folderRoot WindowsIdentityFoundation Windows6.1-KB974405-x86.msu "http://go.microsoft.com/fwlink/?LinkId=190781&clcid=0x409"
dlPreReq $folderRoot WindowsIdentityFoundation Windows6.1-KB974405-x64.msu "http://go.microsoft.com/fwlink/?LinkId=190780&clcid=0x409"
}
else
{
write-host "No folder selected, operation was aborted. Run Create-CRM2011Redist to retry."
}
}

#kick off the script
Create-CRM2011Redist

#end script
Comments (7)

  1. Matt says:

    I downloaded CRM 2011 from http://www.microsoft.com/…/details.aspx and extracted it. I didnt find a folder that had BIDSExtensions, EmailRouter, etc… in it. Where should I put the Redist folder?

  2. Chris says:

    In the root alongside the Client folder

  3. John says:

    Just wanted to say thanks for this. Helped me out a bunch when deploying Microsoft CRM 2011.

  4. Thanks John, we appreciate the feedback!

  5. HKM says:

    Sean: Thank you very much putting this together. You saved me a ton of time.

  6. Sandra says:

    This works quite well for CRM 2016 as well. Just note that the folder where the client installer wants to find the downloaded files is not called Redist. Rather, step 6 should say “copy the sub-folders out of the redist folder to the install folder containing: Server, Client, EmailRouter, and BIDSExtensions folders”

    1. @Sandra, thanks! I have a 2016 version of the script ready to go I just need to get the article written up to accompany the PS script.