The Scripted Version of Installing SSMS
Install and Update SQL Server Management Studio (SSMS) already covers the manual, click-through install via the Visual Studio Installer, the right walkthrough for a one-off install on your own workstation.
This script is the same job automated: silent install or update, detects what’s already there, picks the right method, and adds SSMS to PATH when it’s done. The one to reach for when you’re setting up more than one machine, or when “click through the installer” isn’t something you want to do by hand again.
Why a Scripted SSMS Install Matters
- SSMS 22+ and SSMS 17-20 use completely different installer frameworks, and you can’t upgrade across that boundary in place. This script detects which one is installed and tells you plainly when a manual uninstall has to happen first, rather than failing confusingly partway through.
- Silent by default, with a progress window available when you want to watch it. Fleet installs want silent, a one-off on your own machine might not.
- Adds SSMS to
PATHautomatically once installed, sossmslaunches it from any terminal without hunting for the install directory afterward.
When to Run This Script
- Standing up SSMS on a new machine as part of a broader environment setup
- Updating SSMS across several jump hosts or shared admin boxes without clicking through each one by hand
- Automating environment setup where a human clicking “Next” isn’t the workflow
The Script
# install-ssms.ps1 - Install or update SQL Server Management Studio
#
# SSMS 22+ (default) : downloads vs_SSMS.exe from aka.ms/ssms/22/release/vs_SSMS.exe
# SSMS 17-20 (winget) : winget install Microsoft.SQLServerManagementStudio
#
# Cannot upgrade SSMS 17-20 in-place to SSMS 22 - run uninstall-ssms.ps1 first.
#
# Parameters:
# -Method download|winget : 'download' = SSMS 22 (default), 'winget' = SSMS 20
# -Passive : show VS Installer progress window instead of silent
# -WhatIf : show what would run, no changes
(The full script is in the repo, link below.)
Real Output
Run with -WhatIf first if you want to preview what it’ll do before committing, no elevation needed:
[11:08:47] SSMS 22.7.0 detected (VS Installer framework) - bootstrapper will perform an in-place update.
[11:08:47] WhatIf: download 'https://aka.ms/ssms/22/release/vs_SSMS.exe' -> '...\output-files\patches\ssms\vs_SSMS.exe'
[11:08:47] WhatIf: Start-Process '...\vs_SSMS.exe' --quiet --norestart --wait
How To Run From The Repo
git clone https://github.com/peterwhyte-lgtm/dba-tools
cd dba-tools
.\Initialize-Environment.ps1
.\powershell\patching\ssms\install-ssms.ps1 -WhatIf
.\powershell\patching\ssms\install-ssms.ps1
.\powershell\patching\ssms\install-ssms.ps1 -Method winget
This script lives in the repo at:
Understanding the Results
- “Bootstrapper will perform an in-place update” means no manual uninstall step is needed. That message only appears when the currently installed SSMS is already on the same installer framework as the target.
- A message pointing you to run
uninstall-ssms.ps1first is not an error, it’s the correct outcome. SSMS 17-20 genuinely cannot upgrade in-place to SSMS 22, the script is telling you the real constraint, not failing to handle it. wingetresolves to SSMS 20, not SSMS 22. If you specifically need SSMS 22, use the default download method,winget‘s catalog doesn’t currently carry it.
Best Practices
- Run with
-WhatIffirst on any machine you’re not deeply familiar with, confirm which installer framework it’ll use before committing. - Use
-Passiveon your own workstation if you want to watch progress; leave it silent for anything scripted or unattended. - If a machine is still on SSMS 17-20 and you want SSMS 22, expect to run Uninstall SSMS via PowerShell first, this script will tell you so rather than failing silently.
- After install, a fresh terminal picks up the PATH update automatically; the current terminal gets it live too,
ssmsshould launch immediately without reopening anything.
Related Scripts
You may also find these scripts useful:
- SQL Server Installation and Patching (hub)
- Uninstall SSMS via PowerShell
- Install and Update SSMS (manual walkthrough)
- Patch SQL Server
- SSMS Complete Guide (every SSMS setup, configuration, and troubleshooting post on the site in one place)
- DBA Scripts: The Complete Guide, the map across every script on this site
Frequently Asked Questions
Should I use this script or the manual Visual Studio Installer walkthrough?
Use this script for repeatable installs, fleet setups, or anything you want automated. Use the manual walkthrough for a one-off install on your own workstation where clicking through a GUI once isn’t a burden.
Why does the script refuse to upgrade my SSMS 20 install straight to SSMS 22?
SSMS 22+ moved to the Visual Studio Installer framework entirely, replacing the legacy WiX-based installer used by SSMS 17 through 20. The two frameworks can’t upgrade over each other in place, an uninstall of the old one has to happen first.
Summary
Same job as the manual walkthrough, minus the clicking: detects what’s installed, picks download or winget, and stops you cold before a doomed SSMS 20-to-22 in-place upgrade instead of failing halfway through one.
Reach for it the moment “one more machine” turns into “several.” If a box is still on SSMS 17-20 and you need 22, run Uninstall SSMS via PowerShell first, this script will tell you so rather than pretending it can skip the step. Once it’s done, ssms launches from any terminal, no PATH hunting required.
Leave a Reply