Change the default installation path of SQL Server Management Studio

Since SQL Server 2016, Microsoft has separated SSMS installation from SQL Server Engine installation, and the SQL Server setup page now includes an option to install SSMS.

SSMS

When you click on this, however, it does not install SQL Server Management Studio and instead redirects you to a URL for the most recent version of SQL Server Management Studio SSMS , You’ll also need to download and instal another file that’s close to 800 MB in size. When you execute the SSMS install, however, it never asks you where you want it to go and instead installs it to the default location of C drive. Install and Close are the only options offered during installation, and they do exactly what they say.SSMS install window.JPG

What if you, like me, don’t want it on your C drive and instead want it installed somewhere else? Because Microsoft hasn’t offered a way to alter the install location. I’ll demonstrate how to do it. In my instance, I’m installing it on D Drive rather than C, and I’m doing so with the help of a simple PowerShell Script that updates the registry values and then reverts to the original values after installation.

# 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

There is a better way to do this using command prompt. check below post
https://sqlx86.wordpress.com/2018/12/27/change-the-default-installation-path-for-sql-server-management-studio-using-command-prompt/

1 thought on “Change the default installation path of SQL Server Management Studio

  1. Pingback: Change the Default installation path for SQL Server management Studio using Command Prompt - Saurabh Srivastava's SQL Server Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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