mssqltips logo

How to use RunAs command for SSMS if option does not exist

By:   |   Updated: 2012-03-07   |   Comments (9)   |   Related: More > SQL Server Management Studio


As a best practice in the industry, a DBA often has two logins that are used to access SQL Server; one is their normal Windows login and the other is an admin level login account which has sysAdmin rights on the SQL Server boxes. In addition most of the time the SQL Server client tools are only installed on the local desktop and not on the SQL Server Production Box. In order to use the different login to connect to SQL Server using SSMS you need to use the "Run as" feature. What do you do in the case of Windows 7 or Windows Vista where you can't find the Run As Different User option.


If the Run As different user option is not available while you right click on the SSMS executable or shortcut, you can follow one of the techniques below to use the run as option.

Technique 1 - Run As different User

Step 1: Press and Hold the Shift Key and Right Click on the SSMS executable or shortcut, you should see the Run as different user option in the context menu.

run as different user option

Step 2: Once you click on the Run as different user option the below dialog box will appear. You have to enter the User Name or Domain\User Name and Password to run the application with that user's security context.

run as different user security credentials

Technique 2 - Run As different User using command prompt

Step 1: Go to the command prompt and type runas /? and you should see the Run As help as shown below.

runas command line utility

Step 2: Enter the below command in the command prompt to open SSMS with the different user's security context. It will prompt you for the password; enter the password to run the application.  Here I am entered "aa\jshah" for the domain\user to use.

c:\>runas /user:aa\jshah "C:\Program Files\Microsoft SQL Server\100\Tools\Binn

After I run the above comand I am prompted for the password as shown below.

runas command line enter password prompt

Setup a Shorcut to do this

If you are going to use the secondary ID to always to connect to SQL Server, you can create a shortcut to open SSMS with the secondary ID context as shown below. 

Right click on the desktop, go to New and click Shortcut.

creating a shortcut for a runas command

Paste or type the above Run As command into the Target box. Then the next time you open SSMS just use this shortcut to use the Secondary ID.

shorcut properties for runas.exe command
Next Steps
  • If you are not already doing this, you should look into using the two Windows accounts security standards in your organization's database environment
  • Run SSMS on the local machine instead of having to login to the production box
  • Read these other security tips

Last Updated: 2012-03-07

get scripts

next tip button

About the author
MSSQLTips author Jugal Shah Jugal Shah has 8+ years of extensive SQL Server experience and has worked on SQL Server 2000, 2005, 2008 and 2008 R2.

View all my tips
Related Resources

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

Email me updates

Signup for our newsletter

I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.

Monday, February 18, 2019 - 10:47:21 AM - hort Back To Top


It looks interesting but i always have a message : runas error unable to acquire user password

If i put another password, i just have the message thtat password or user is not good.

so do you have an idea of the problem ?


Friday, September 09, 2016 - 4:32:09 PM - JD Back To Top

 This worked great for me on a SQL 2014 box. Thanks for posting!


Friday, March 18, 2016 - 11:38:32 AM - Nadum Charles Back To Top

 Jugal Shah,


Thank you so much for this solution. Ite was spot on.




Wednesday, February 26, 2014 - 8:45:15 AM - Mawande Back To Top

Best note on this topic. found it very usefull

Wednesday, March 14, 2012 - 5:46:53 AM - kamesh Back To Top

how to upgrading the sql server 2000 to 2005

Monday, March 12, 2012 - 1:49:43 AM - dips Back To Top

Nice Post..

Thursday, March 08, 2012 - 10:10:32 AM - Mike Hinds Back To Top

I've also been required to use a Desktop account (for email, Word, Excel) and an Admin account for anytime I log into a server. I had learned the "{SHIFT} Run As" trick, but my desktop is locked down so hard that it then wants an account that is Admin on the desktop in order to proceed. How could we do both RUN AS (different account) and "Run As Administrator"?

Thursday, March 08, 2012 - 8:36:09 AM - Michael J. Swart Back To Top

Hi there, Very helpful post. 

Wouldn't it be great if we could connect to a database using different Windows credentials from within SQL Server? I wonder if there's an Microsoft Connect item for that.

Thursday, March 08, 2012 - 7:18:14 AM - Bill Ross Back To Top

Good, helpful, post. Thanks!


get free sql tips

I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.

Learn more about SQL Server tools