Skip to content

Instantly share code, notes, and snippets.

@RIKIKU
Last active February 1, 2017 01:41
Show Gist options
  • Save RIKIKU/abd8e0d6c61912eb188c18050f75bae6 to your computer and use it in GitHub Desktop.
Save RIKIKU/abd8e0d6c61912eb188c18050f75bae6 to your computer and use it in GitHub Desktop.
#This is a script to automatically download and create the folders for the residtributables needed to install CRM 2016.
#V1.0.0
do{[int]$bitness = Read-Host "What bitness the installed version of Office e.g. 32,64"}
while(!($bitness -eq 32) -xor ($bitness -eq 64))
Add-Type -AssemblyName System.Windows.Forms
#get the source DIR.
$SourceDIRDLG = New-Object Windows.Forms.FolderBrowserDialog
$SourceDIRDLG.Description = "Select the download folder"
$SourceDIRDLG.ShowNewFolderButton = $true
if($SourceDIRDLG.ShowDialog() -ne 'OK') {throw "process stopped by user"}
$dirs = "dotNETFX","ReportViewer","SQLCE","SQLExpr","SQLExprRequiredSp","VCRedist","VCRedist10","WindowsIdentityFoundation","SQLSystemCLRTypes"
foreach($dir in $dirs)
{
mkdir "$($SourceDIRDLG.SelectedPath)\$dir"
switch ($dir)
{
'dotNETFX' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=328855 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\NDP452-KB2901907-x86-x64-AllOS-ENU.exe" }
'ReportViewer' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=390736 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\ReportViewer.msi" }
'SQLCE' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=253118 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\SSCERuntime_x64-ENU.exe"
Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=253117 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\SSCERuntime_x86-ENU.exe"
}
'SQLExpr' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=403076 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\SQLEXPR_x86_ENU.exe"}
'SQLExprRequiredSp' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=403077 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\SQLEXPR_x86_ENU.exe"}
'VCRedist' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=402059 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\vcredist_x64.exe"
Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=402042 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\vcredist_x86.exe"
}
'VCRedist10' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=404264 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\vcredist_x64.exe"
Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=404261 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\vcredist_x86.exe"
}
'WindowsIdentityFoundation' {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=190780 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\Windows6.1-KB974405-x64.msu"
Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=190781 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\Windows6.1-KB974405-x86.msu"
}
'SQLSystemCLRTypes' {
if($bitness -eq 64) { Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkID=188392 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\SQLSysClrTypes_x64.msi"}
elseif($bitness -eq 32) {Invoke-WebRequest http://go.microsoft.com/fwlink/p/?LinkId=390735 -OutFile "$($SourceDIRDLG.SelectedPath)\$dir\SQLSysClrTypes_x86.msi"}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment