To install the 2014 PowerShell tools, the script below will help make it a bit easier.
First all downloads are referenced from this URL (specific for SQL 2014)
http://www.microsoft.com/en-ca/download/details.aspx?id=42295
I use Windows 64-Bit so if you use 32-Bit make sure you update your links
# Microsoft® Windows PowerShell Extensions for Microsoft SQL Server® 2014 https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/PowerShellTools.msi # Microsoft® SQL Server® 2014 Shared Management Objects https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/SharedManagementObjects.msi # Microsoft® System CLR Types for Microsoft SQL Server® 2014 https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/SQLSysClrTypes.msi
# Microsoft® Windows PowerShell Extensions for Microsoft SQL Server® 2014 https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x86/PowerShellTools.msi # Microsoft® SQL Server® 2014 Shared Management Objects https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x86/SharedManagementObjects.msi # Microsoft® System CLR Types for Microsoft SQL Server® 2014 https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x86/SQLSysClrTypes.msi
# Directory Parameter
$FileDirectory = "C:\Temp\PowerShell_Tools\"
# Delete directory if it exists
if(Test-Path $FileDirectory)
{
Remove-Item -Recurse -Force $FileDirectory
mkdir $FileDirectory;
}
else
{
mkdir $FileDirectory;
# cd $FileDirectory;
}
$hostfiltered = ""
clear
$ServerList = "https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/PowerShellTools.msi","https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/SharedManagementObjects.msi","https://download.microsoft.com/download/1/3/0/13089488-91FC-4E22-AD68-5BE58BD5C014/ENU/x64/SQLSysClrTypes.msi"
$FileNumber = 1
write-host $ServerList.count total host lists read from file
foreach ($line in $ServerList)
{
# write-host $line
# We assume the file you download is named what you want it to be on your computer
$FileName = [System.IO.Path]::GetFileName($line)
$FullFilePath = "$($FileDirectory)$($FileName)"
# write-host $FullFilePath
# Give a basic message to the user to let them know what we are doing
Write-Host "`r`nDownloading '$line' to '$FullFilePath'"
# Download - Start
$uri = New-Object "System.Uri" "$line"
$request = [System.Net.HttpWebRequest]::Create($uri)
$request.set_Timeout(15000) #15 second timeout
$response = $request.GetResponse()
$totalLength = [System.Math]::Floor($response.get_ContentLength()/1024)
$responseStream = $response.GetResponseStream()
$targetStream = New-Object -TypeName System.IO.FileStream -ArgumentList $FullFilePath, Create
$buffer = new-object byte[] 10KB
$count = $responseStream.Read($buffer,0,$buffer.length)
$downloadedBytes = $count
while ($count -gt 0)
{
[System.Console]::Write("`r`nDownloaded {0}K of {1}K", [System.Math]::Floor($downloadedBytes/1024), $totalLength)
$targetStream.Write($buffer, 0, $count)
$count = $responseStream.Read($buffer,0,$buffer.length)
$downloadedBytes = $downloadedBytes + $count
}
$targetStream.Flush()
$targetStream.Close()
$targetStream.Dispose()
$responseStream.Dispose()
# Give a basic message to the user to let them know we are done
Write-Host "`r`nDownload complete"
# Download - Stop
$FileNumber = $FileNumber + 1
}
dir "$($FileDirectory)*.msi" | Unblock-File
.\SQLSysClrTypes.msi /qr /norestart
.\SharedManagementObjects.msi /qr /norestart
.\PowerShellTools.MSI /qr /norestart
Reference: http://www.jbmurphy.com/2014/01/16/quickly-install-the-sql-powershell-toolls-on-your-local-machine/
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.