Computer and Software Support


Runas

This page is from Microsoft

Updated: January 21, 2005

Allows a user to run specific tools and programs with different permissions than the user's current logon provides.
 
 
Syntax
runas [{/profile | /noprofile}] [/env] [/netonly] [/savedcreds] [/smartcard] [/showtrustlevels] [/trustlevel] /user:UserAccountName "ProgramName PathToProgramFile"
Parameters
/profile
Loads the user's profile. /profile is the default.
/no profile
Specifies that the user's profile is not to be loaded. This allows the application to load more quickly, but it can also cause a malfunction in some applications.
/env
Specifies that the current network environment be used instead of the user's local environment.
/netonly
Indicates that the user information specified is for remote access only.
/savedcreds
Indicates if the credentials have been previously saved by this user.
/smartcard
Indicates whether the credentials are to be supplied from a smartcard.
/showtrustlevels
Lists the /trustlevel options.
/trustlevel
Specifies the level of authorization at which the application is to run. Use /showtrustlevels to see the trust levels available.
/user:UserAccountName"ProgramName PathToProgramFile"
Specifies the name of the user account under which to run the program, the program name, and the path to the program file. The user account format should be User@Domain or Domain\UserName.
/?
Displays help at the command prompt.
Remarks
  • It is good practice for administrators to use an account with restrictive permissions to perform routine, nonadministrative tasks, and to use an account with broader permissions only when performing specific administrative tasks. To accomplish this without logging off and back on, log on with a regular user account, and then use the runas command to run the tools that require the broader permissions.
  • For examples of the use of the runas command, see Related Topics.
  • The use of runas is not restricted to administrator accounts, although that is the most common use. Any user with multiple accounts can use runas to run a program, MMC console, or Control Panel item with alternate credentials.
  • If you want to use the Administrator account on your computer, for the /user: parameter, type one of the following:

    /user:AdministratorAccountName@ComputerName

    /user:ComputerName\AdministratorAccountName

  • If you want to use this command as a domain administrator, type one of the following:

    /user:AdministratorAccountName@DomainName

    /user:DomainName\AdministratorAccountName

  • With the runas command, you can run programs (*.exe), saved MMC consoles (*.msc), shortcuts to programs and saved MMC consoles, and Control Panel items. You can run them as an administrator while you are logged on to your computer as a member of another group, such as the Users or Power Users group.
  • You can use the runas command start any program, MMC console, or Control Panel item. As long as you provide the appropriate user account and password information, the user account has the ability to log on to the computer, and the program, MMC console, or Control Panel item is available on the system and to the user account.
  • With the runas command, you can administer a server in another forest (the computer from which you run a tool and the server you administer are in different domains).
  • If you try to start a program, MMC console, or Control Panel item from a network location using runas, it might fail because the credentials used to connect to the shared network resource are different from the credentials used to start the program. The latter credentials may not be able to gain access to the same shared network resource.
  • Some items, such as the Printers folder and desktop items, are opened indirectly and cannot be started with the runas command.
  • If the runas command fails, the Secondary Logon service might not be running or the user account you are using might not be valid. To check the status of the Secondary Logon service, in Computer Management, click Services and Applications, and then click Services. To test the user account, try logging on to the appropriate domain using the account.
Examples
To start an instance of the command prompt as an administrator on the local computer, type:

runas /user:localmachinename\administrator cmd

When prompted, type the administrator password.

To start an instance of the Computer Management snap-in using a domain administrator account called companydomain\domainadmin, type:

runas /user:companydomain\domainadmin "mmc %windir%\system32\compmgmt.msc"

When prompted, type the account password.

To start an instance of Notepad using a domain administrator account called user in a domain called domain.microsoft.com, type:

runas /user:user@domain.microsoft.com "notepad my_file.txt"

When prompted, type the account password.

To start an instance of a command prompt window, saved MMC console, Control Panel item, or program that will administer a server in another forest, type:

runas /netonly /user:Domain\UserName "Command"

Domain\UserName must be a user with sufficient permissions to administer the server. When prompted, type the account password.

Formatting legend

Format Meaning
Italic Information that the user must supply
Bold Elements that the user must type exactly as shown
Ellipsis (...) Parameter that can be repeated several times in a command line
Between brackets ([]) Optional items
Between braces ({}); choices separated by pipe (|). Example: {even|odd} Set of choices from which the user must choose only one
Courier font Code or program output