Skip to content

Instantly share code, notes, and snippets.

@justinsoliz
Created February 17, 2018 19:45
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save justinsoliz/34324700ea93c7b77b4ac3e132584de7 to your computer and use it in GitHub Desktop.
Save justinsoliz/34324700ea93c7b77b4ac3e132584de7 to your computer and use it in GitHub Desktop.
Powershell - Install Sql Server Management Studio
# Set file and folder path for SSMS installer .exe
$folderpath="c:\windows\temp"
$filepath="$folderpath\SSMS-Setup-ENU.exe"
#If SSMS not present, download
if (!(Test-Path $filepath)){
write-host "Downloading SQL Server 2016 SSMS..."
$URL = "https://download.microsoft.com/download/3/1/D/31D734E0-BFE8-4C33-A9DE-2392808ADEE6/SSMS-Setup-ENU.exe"
$clnt = New-Object System.Net.WebClient
$clnt.DownloadFile($url,$filepath)
Write-Host "SSMS installer download complete" -ForegroundColor Green
}
else {
write-host "Located the SQL SSMS Installer binaries, moving on to install..."
}
# start the SSMS installer
write-host "Beginning SSMS 2016 install..." -nonewline
$Parms = " /Install /Quiet /Norestart /Logs log.txt"
$Prms = $Parms.Split(" ")
& "$filepath" $Prms | Out-Null
Write-Host "SSMS installation complete" -ForegroundColor Green
@SalimGangji
Copy link

Hi there,

Thank you for this amazing script - for SSMS 18.1 all you need to do is to update the $URL parameter, so that it points to https://aka.ms/ssmsfullsetup

Cheers!

@CubsRep
Copy link

CubsRep commented Aug 4, 2020

Awesome. thanks for sharing it

@Mario2286
Copy link

Any idea to amend this powershell scripts so that it can remotely install SSMS in multiple server with SSMS setup files already copy to multiple servers

@vmasule
Copy link

vmasule commented Aug 27, 2021

@Mario2286 you can achieve that using Ansible Configuration management tool.

@securus777
Copy link

@Mario2286 You should be able to change the download URL to be the UNC path to the location on the server(s).

@Vikas-jk
Copy link

Excellent never thought, we can download SSMS using PowerShell also, it looks much easier to download and install using powershell.
If anyone needs to download using .exe
Check Download and install SQL Server Management Studio
Thanks.

@alexRota
Copy link

alexRota commented Sep 8, 2023

Apparently the pipeline doesn't wait for the exe to finish download so the artifact it produces has 0KB , any ideas how to fix this?

@Chandrashekar-MS18
Copy link

It worked super fast. Thanks for the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment