How to Run SQL Server Management Studio as a Different Windows User

If you’re using Windows Authentication for your SQL Server database you’ll need to run SQL Server Management Studio (SSMS) as that Windows account to test queries.  SSMS normally runs as the user logged in to Windows, but there is a simple way to run it as the database access account.

Just shift-right-click on a shortcut and select “Run as a different user“.  (Windows 7)

Shift-Right-Click a shortcut to run the program as a different Windows User.
Shift-Right-Click a shortcut to run the program as a different Windows User. (Windows 7)

You’ll be presented with a Windows login prompt.  Log in and SSMS will open.  Note that the connection dialog has the new user in the Windows Authentication area

Connect to Server Dialog
Connect to Server Dialog

Note: You’re now running the program as a different user, so it probably won’t have access to the files you normally use.  My fix was to give the account read/write to the folder where I hold my SQL scripts.

This tip will work for other programs too.  Let me know how you used it in the comments below.

13 Comments

Scott says:

Thanks Steve, years later this helped me.

Nadum Charles says:

Great stuff

Larry Page says:

It’s not your fault. This is such an epically poor program with its ridiculous certificates and users and roles and crap that even with the certification tests passes I still can’t navigate to the folder that has my mdf and running the god forsaken smss as an administrator doesn’t fix it. I know people at MSFT stare toward silicon valley wishing they were them. The LA clippers will be proof that ballmer is a terrible CEO and he can rot in hell

Colleen says:

Works well — good trick! It would be great if SSMS 2012 would allow you to save these other credentials with a registered server, but baby steps, right? We can’t expect Microsoft to go too fast. ;)

POST AD FOXTIC NET.frame

sjaak1970 says:

Well as normal it looks so good on paper but when trying the practical thing there seems to be just one little thing that’s not working. I want to connect to a database that has SQL authentication enabled. My username doesn’t have access so i got a Domain user name and password for connecting to the database. I can’t just type it’s SQL authentication. When i try to open ssms as described above it seems to be working allrtight it’s opening SQL Server management studio. Butt… it’;s just opening with my account :(

mdivk says:

Nice trick. But what about if you do not have the password for the login? I want to use SSMS and connect to the subject DB using the dedicated domain id (which only DBA holds the credential), any idea? Thanks.

Mohan Lekshmanan says:

Very good stuff

Venu says:

Helpful post :)

* Dirk Watkins says:

@Steve – Good points! Thanks for the tip.

This approach won’t work if the database user is either a different domain or doesn’t have an account on the computer you’re using. In order to get around that you can set up a short-cut with the path “runas /netonly /user:DOMAIN\USER “. This lets you override the domain and also the /netonly flag makes it so that you’re interacting with the local computer as the logged in user and across the network as the network user. This should allow you to avoid having to do anything special for file permissions.

Ahh, it ate part of my reply. The command line is:

runas /netonly /user:DOMAIN\USER “path to Ssms.exe”

It will pop up a command prompt window to ask you for the password and then launch SSMS.

Rodney D says:

yeah, this helped me a bunch. I have been run runas without the /netonly and I wasn’t able to read or write to files on the network and now I can. THANKS!!!!

Leave a Reply