Saturday, October 16, 2010

RunAs Utility

I've recently discovered (been introduced to) the runas command line utility which I was previously unaware of. This command allows you to run in the context of another user which is particularly useful if you are testing access permissions under different user names. The syntax is:

runas /user:mydomain\myuser program.exe

The one annoyance is that when you run that command it requires that you type in the password and if its a particularly long and complex password I will often make a mistake. However, because this is in a command window you can copy the password to the clipboard and right click at the password prompt and select Paste and it works.

Try running the following with a different user who is registered on your local computer.

runas /user:mydomain\myuser cmd

This will bring up a new command prompt in the context of that user. Now type the command...

whoami both command windows. You will see that each command window is running in the context of a different user.

1 comment:

  1. Hey Guy, it's remi (from startup weekend and DCC, etc). I can't find contact info for you and wanted to email you. Can you shoot me an email at remi [at] remitaylor (dot) com?