Change the default installation path of SQL Server Management Studio

Microsoft has separated installation of SSMS from SQL Server Engine Installation since SQL Server 2016 and if you see the SQL server setup page it has an option to Install SSMS

SSMS

However when you click on this it doesn’t install SQL Server Management Studio and redirects you to a URL for the newest version available of SSMS , and it is another file of close to 800 MB that you have to download and then Install. However when you run the SSMS install it never asks you for which Location you want to install it to and it uses the Default location of C drive to be installed. Only options available during install are Install and  Close, which does the job they are named for. SSMS install window.JPG

What if like me you don’t want it on C drive and want it to be installed someplace else. Since MS has not provided any option to customize the install location. I will show you how to do this. In my case I am installing it on D Drive instead of C and to do so I am using a simple PowerShell Script to update the registry values and post install revert to original Values.

# Update the Value of default installation Directory

$RegKey =”HKLM:\Software\Microsoft\Windows\CurrentVersion”

Set-ItemProperty -Path $RegKey -Name “ProgramFilesDir” -Value “D:\Program Files”

Set-ItemProperty -Path $RegKey -Name “ProgramFilesDir (x86)” -Value ‘D:\Program Files (x86)’

Get-ItemProperty -Path $RegKey -Name “ProgramFilesDir”

Get-ItemProperty -Path $RegKey -Name “ProgramFilesDir (x86)”

Write-Host “1. Run the SSMS installer and wait for its completion… (Start-Process -Wait)” -ForegroundColor Yellow

$process=”D:\Software\SSMS-Setup-ENU.exe”

$args=”/install”

Start-Process $process -ArgumentList $args -Wait

Write-Host “`nProcess `”$process`” has been executed and is now stopped.” -ForegroundColor DarkGreen

# Revert the Value to default installation Directory

$RegKey =”HKLM:\Software\Microsoft\Windows\CurrentVersion”

Set-ItemProperty -Path $RegKey -Name “ProgramFilesDir” -Value “C:\Program Files”

Set-ItemProperty -Path $RegKey -Name “ProgramFilesDir (x86)” -Value ‘C:\Program Files (x86)’

Get-ItemProperty -Path $RegKey -Name “ProgramFilesDir”

Get-ItemProperty -Path $RegKey -Name “ProgramFilesDir (x86)”

 

However after doing this you still have to update the location of icons in start menu to the updated location of the SSMS file.

In my case I had to browse to

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SQL Server Tools 17

Right click on SSMS and update the target to the new location of SSMS program files and you are all set to go

SSMS Target

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.