Summary
- Run a Program as Different User
- Run a Program as Local System Account
- Run a Program as Different Domain User
Run a Program as Different User
You can execute a program under a different user account by using the command line tool RunAs. Use the below command to open new CMD window under different user
C:> RunAs /user:rtest cmd
You will prompted to enter password when you execute this command. type password and click ‘Enter’ to open new cmd window under the different user ‘rtest’.
Run a Program as System Account
You can execute or run a program under local system account by using sysinternals‘s Psexec utility. you can download at
http://technet.microsoft.com/en-us/sysinternals/bb897553. You can use the -s switch to run a program as the system account. The following example shows how to start a cmd.exe session under the system account:
C:PSTools> PsExec -s cmd.exe PsExec v2.1 - Execute processes remotely Copyright (C) 2001-2013 Mark Russinovich Sysinternals - www.sysinternals.com Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:Windowssystem32>whoami nt authoritysystem C:Windowssystem32>exit cmd.exe exited on HP-PC with error code 0.
Once you have completed the work you can revert to current user by executing exit command.
Run a Program as Different Domain User for Remote Connections
You can execute a program under different domain user for remote connections by using the parameter /netonly in RunAs command. Use the below command to open new CMD window under different domain user
RunAs /netonly /user:work2008RDtest cmd
When you start a program with RunAs /netonly, the program will execute on your local computer as the user you are currently logged on as, but any connections to other computers on the network will be made using the user account specified.
Thanks,
Morgan
Software Developer