How to create a "run as different user" shortcut for SQL Server

Problem: I always need to open SQL Server using my admin account but I don't want to keep on doing right click + run as different user, then type my admin username and super long admin password.

My solution? I created a shortcut that launches SQL Server using a different user. Now all I have to do Run "sqlserver" and the app will automatically open using my admin account. That's a major reduction in keystroke yknow! Hahaha



How:

Create a shortcut with the following target and place it in your user folder.

C:\Windows\System32\runas.exe /savecred /user:domain\surfandperf-admin "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"


In detail:

  1. Navigate to where your SQL Server executable file is.
    Usually it's inside C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\ as ssms.exe
  2. Right click ssms.exe >> Send to >> Desktop (create shortcut)
  3. On your desktop >> right click the SQL Server shortcut created >> go to Properties >> update the target to this:

    C:\Windows\System32\runas.exe /savecred /user:domain\surfandperf-admin "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"

    Basically I just prepended the target with the red text, making sure to replace the /user part with the username I want to login with.

    I used /savecred to save the password for future launches


  4. Move to the shortcut to your user folder and rename it with whatever you want the shortcut name to be

  5. Now you can launch it using the run dialog.


On first launch it will ask for a password.



Hope it works! I really just want fewer clicks and keystrokes for everything hehe.

Share: