Runas Tip for Windows

This is a super quick tip if you find yourself repeatedly wanting to run something as another user.

A good example I often use is if I want to run SQL Server Management Studio using my admin account, or likewise, if I want to perform privileged commands as an admin in PowerShell. Right-clicking and doing all that run as dance through the context menu is a pain, so this is a quick solution saving you some effort.

  • First, right click in a folder, choose new then shortcut.
  • In the “Type the location of the item” box, add this:
1
C:\Windows\System32\runas.exe /user:domain\user /savecred" "path-to-command-to-run"

In the command above, replace domain\user with your domain & user combination.

Then, change path-to-command-to-run with the full path to your executable.

  • Click Next
  • Give it a name
  • Click Finish
  • Now double click the shortcut and enter any credentials

You should now be able to run a command as another user, repeatedly.


Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com