Dynamics CRM in the Field

Information from the Microsoft Dynamics CRM PFE team working in the field

Automate creating a CRM 2013 Redist folder to install CRM 2013 without an internet connection

Automate creating a CRM 2013 Redist folder to install CRM 2013 without an internet connection

Rate This
  • Comments 7

We’re back for another round of using PowerShell to automatically create a Redist folder, but I’ve recently updated it for CRM 2013 (you can find the 2011 version here and for more information on the 2013 downloads go to our other blog post here which lists each file with the detailed download URL).  You’ll notice there’s a couple of new pre-requisites and a couple that are no longer needed.  Simply take the script from the bottom of the post and paste it into a PowerShell console on a computer that has internet access, it will prompt you for a location to create a “REDIST” folder, it will also automatically create all the subfolders and download all the pre-requisites for you.  Once completed this Redist folder can be dropped into the files extracted from the CRM 2013 Trial download – this step will allow the installation to use locally downloaded pre-requisite installation files instead of downloading them from the internet which can save time and is required for installing the CRM Server bits on servers that do not have direct internet access.

Instructions on how to use PowerShell to build your CRM 2013 Redist Folder:

  1. Open PowerShell on the computer you have internet access on (NOTE: if your CRM Server installation language is different from 0x409 & ENU – make sure to update them in the script , here is a list of hex codes and use the matching language identifier from your CRM installation)
  2. Copy the script below top to bottom (from the “#begin script” to the “#end script”) or optionally download the script as a txt file
  3. Paste it right into PowerShell – if it doesn’t execute hit enter to run the “Create-CRM2013Redist” function
  4. This will pop up a folder picker, use this to choose the location of the Redist folder
  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 (14 Folders), then download 30 files, this should total about 350MB 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 including your newly created Redist folder:

image

Download the PowerShell Script as a .txt file.

Sean McNellis

Follow the conversation:
@seanmcne
@pfedynamics | http://www.pfedynamics.com

   


PowerShellCreateRedistFolderCRM2013.txt script:

#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-CRM2013Redist()
{
$linkRoot = "http://go.microsoft.com/fwlink/?LinkId="
$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 "dotNetFx40_Full_x86_x64.exe" $linkRoot"182091&clcid="$LHex
dlPreReq $fr dotNETFX "NDP40-KB2600211-x86-x64.exe" $linkRoot"299426&clcid="$LHex
dlPreReq $fr WindowsIdentityFoundation Windows5.2-KB974405-x86.exe $linkRoot"200432&clcid="$LHex
dlPreReq $fr WindowsIdentityFoundation Windows5.2-KB974405-x64.exe $linkRoot"200430&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.exe $linkRoot"193386&clcid="$LHex
dlPreReq $fr SQLExpr SQLEXPR_x86_$langCode.exe $linkRoot"179623&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"195255&clcid="$LHex
dlPreReq $fr VCRedist vcredist_x64.exe $linkRoot"195257&clcid="$LHex
dlPreReq $fr VCRedist9SP1 vcredist_x86.exe $linkRoot"299417&clcid="$LHex
dlPreReq $fr VCRedist9SP1 vcredist_x64.exe $linkRoot"299585&clcid="$LHex
dlPreReq $fr IDCRL wllogin_32.msi $linkRoot"194721&clcid="$LHex
dlPreReq $fr IDCRL wllogin_64.msi $linkRoot"194722&clcid="$LHex
dlPreReq $fr Msoidcrl msoidcli_32bit.msi $linkRoot"317650&clcid="$LHex
dlPreReq $fr Msoidcrl msoidcli_64bit.msi $linkRoot"317651&clcid="$LHex
}
else
{
write-host "No folder selected, operation was aborted. Run Create-CRM2013Redist to retry."
}
}

#kick off the script
Create-CRM2013Redist

#End Script
  • Great information. Thanks!

  • Great post

  • langCode & LHex  value should ref.  :  msdn.microsoft.com/.../ee825488(v=cs.20).aspx

  • Wow.  I spend two full days trying to package and deploy this software.. of course I didn't find this until my time was spent. Thanks a ton for sharing!  Worked great for the CRM 2013 for Outlook Client!  

  • @Seb & Scott - thanks for the feedback!

    @MR_Cook - I'm glad it worked well for you! And I hope we've earned your readership in the future :) don't forget to subscribe on the right side of the blog and you'll get future articles as we post them.  

    @tangxl99 - thanks for the reference!  

  • I had an issue with the script not working via a proxy server so I needed to add the following 2 lines at the start of the function. Hope this helps other with a proxy server. I found this thanks to Jason Stangroome (blog.stangroome.com/.../powershell-update-help-and-an-authenticating-proxy)

    function Create-CRM2013Redist()

    {

     $wc = New-Object System.Net.WebClient

     $wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

  • Great @DSpencer - thanks for adding that!

Page 1 of 1 (7 items)
Leave a Comment
  • Please add 2 and 6 and type the answer here:
  • Post