To do this, update the registry value using the powershell script, and then run the installation. After installation, registry values ββare reset to their default values.
Update the 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
Return 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)"
update the location of the Start menu icons to the updated location of the SSMS file.
In my case, I had to browse
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft SQL Server Tools 17
Right-click on SSMS and update the target with the new location of the SSMS program files, and you are ready to go. For detailed instructions https://sqlx86.com/2018/06/28/install-ssms-to-a-different-location/
source share