Run programs as another user in Windows 2000 / Windows XP

by Wayne Maples [Published on 20 April 2004 / Last Updated on 20 April 2004]

Windows 2000 / Windows XP comes with a commandline utility, runas.exe , which allows one to run a program using the access rights of that user. What is required is the User name, Password, and Domain. For example, if I am logged onto Windows 2000 / Windows XP Professional with a normal user account and need to edit the registry, I can do so without having to logoff and back on with my admin account.

runas /user:waynesdomain\myadminaccount regedt32.exe

Runas can be used to start any program, MMC console, or Control Panel item as long as the following requirements are met:

  • You provide the appropriate user account and password information.
  • The user account has the ability to log on to the computer.
  • The program, MMC console, or Control Panel item is available on the system and to the user account.

Using Runas across the network may fail. The credentials used to run the program may not have adequate access to the network share. If you try to start a program, MMC console, or Control Panel item from a network location using Run as, it might fail because the credentials used to connect to the network share are different from the credentials used to start the program.

Windows Explorer and desktop icons can be started using Runas functionality. You do not have to log off as a user and back on as an admin. Very helpful troubleshooting a problem on a user's workstation or for performing admin tasks from your workstation. Hold down the shift key and right-click the shortcut or icon you want to run. You will be prompted for login information and then the program will run with that account's authenication, rights and permissions. Remember to unload the program if you are doing this on a user's workstation.

To get all the commandline options:

runas /?

A better use of runas is remote administration. Telnet into the Windows 2000 / Windows XP workstation/server and run programs as administrator. We have sms remote for this purpose but if you don't have a product like SMS inplace, this would work well to support Windows 2000 / Windows XP workstations.

Runas is not scriptable because pw has to be entered interactively. There are utilities to allow runas to be scripted.

  • CPAU Runas alternative supporting encoded passwords.
  • LSrunas/LSRunase Console based Runas alternatives, the latter supports encoded passwords.
  • AutoIt (v3) Scripting language for automating the Windows GUI.
  • RunAsSpc

Related Tips:

Step-by-Step Guide to Using Secondary Logon in Windows 2000
After you install Windows 2000 Service Pack 1, the runas command may not work correctly
Runas Utility Uses Default Profile

See Also

Featured Links