Adding SSMS to the PATH variable with Powershell

28 January,2020 by Jack Vamvas

Question: I've installed the latest SQL Server Management Studio onto a server. I can find the ssms.exe through the directory - but I cannot start the SQL Server Management Studio through the cmdline - i.e type "ssms" in the command line. How can I fix this problem?

Answer: I had a similar problem recently when installing SSMS 18.4. I downloaded the binary  - installed without any errors - but then couldn't execute "ssms" from the command line. 

To solve this issue I added the directory with ssms.exe into the PATH variable and applied this as a machine wide change , i.e all users on this server could now access SSMS through the command line. 

The Powershell code used was : 

 

$PATH = [Environment]::GetEnvironmentVariable("PATH")
$ssms_path = "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE"
[Environment]::SetEnvironmentVariable("PATH", "$PATH;$ssms_path", "Machine")


Applying "Machine" on the last line - applied this environment variable to all users

Read more on SSMS and command line 

SQL Server - Open SSMS on the Command Line (SQL Server DBA)

How to start SSMS as Administrator


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Adding SSMS to the PATH variable with Powershell


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer