By default, Windows XP has multiple accounts inside it. Usually when Windows XP installed for the first time, Windows put at least two accounts within it, the accounts are Administrator and Guest. If you're an Administrator for your office's LAN, I am sure you won't give administrator's accounts right for your clients. Usually, you would give them Power User or User right. Also, some programs will configure to run in Administrator permission only. So when you works at client computer that logged as User right, you'll get trouble when you're open a program which needs Administrator right to run. Yup, you can log off then login as Administrator but that's not an efficient way. Then, Microsoft gave us RunAs command to make it be easier.

The RunAs command allows you to work with the command shell using any user account that has sufficient permissions to perform a task from the command line. And don't forget that RunAs command is not run to run an application as an Administrator account only but you can run as your own account. RunAs is similar with sudo command in UNIX console but if sudo run for Administrator privilege only.

Actually, you also can use Run As ability in context menu when the EXE file is right clicked. But this time we will discuss about RunAs command in MSDOS console.
Open your MSDOS console first to try this command, by click Start - Run menu, type cmd in textbox then press Enter. At console prompt type runas to display all its parameters.
RunAs command requires the Secondary Logon service to run. To check the service status, open Control Panel - Administrative Tools then double click Services icon. Find Secondary Logon service in the list, double click it to see the status (by default, Windows has been enable it), if it is in Stop status, just click Start button. Or you can do it through MSDOS console, type in its prompt : net start seclogon then hit Enter key.
OK back to RunAs command, RunAs has syntax to run like this runas /parameter(s) program_to_run.
And here are its parameters :

/profile : Loads the user profile for the user specified in the /user parameter.
/noprofile : Specifies that no user profile is to be loaded.
/env : Specifies that the current environment, rather than the network environment, should be used.
/netonly : Indicates that user access specified in the /user parameter is for remote access only.
/savecreds : Uses the credentials (username and domain name) the user has saved instead of loading a new copy.
/smartcard : Indicates that the smart card is to be used for supplying user credentials.
/trustlevel : Indicates the level of authorization at which the user can run the application.You can use the /showtrustlevels parameter to display a list of available trust levels.
/showtrustlevels : Displays a list of options for the /trustlevel parameter.
/user:UserAccountName : Specifies the name of the user account to be used to run the program.The user account name following the RunAs command must be specified in the username@domain or domain\username format.
program : Specifies the command, program, or application to be run under the credentials of the user specified in the /UserAccountName parameter.

And these some examples of RunAs command :
runas /user:Administrator winword.exe
runas /user:Farrel "notepad c:\data\manual.txt"

I hope this article can make you understand the runas command easily.

0 comments