Runas


Applies To: Windows Server 2008,Windows HPC Server 2008 R2,Windows XP,Windows Server 2003 with SP1,Windows Vista,Windows Server 2003,Windows Server 2000,Windows Server 2003 R2,Windows 7

Allows a user to run specific tools and programs with different permissions than the user's current logon provides.

Runas is a command-line tool that is built into Windows Vista. To use runas at the command line, open a command prompt, type runas with the appropriate parameters, and then press ENTER.

In the user interface for Windows Vista, the Run as… command has been changed to Run as administrator. However, you should rarely have to use the Run as administrator command because Windows Vista will automatically prompt you for an administrator password when it is needed.

For examples of how this command can be used, see Examples.

Syntax


Copy Code

runas [{/profile | /noprofile}] [/env] [{/netonly | /savecred}] [/smartcard] [/showtrustlevels] [/trustlevel] /user:<UserAccountName> "<ProgramName> <PathToProgramFile>"

Parameters

Parameter

Description

/profile

Loads the user's profile. This is the default. This parameter cannot be used with the /netonly parameter.

/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. This parameter cannot be used with the /profile parameter.

/savecred

Indicates if the credentials have been previously saved by this user. This parameter is not available and will be ignored on Windows Vista Home or Windows Vista Starter Editions. This parameter cannot be used with the /smartcard parameter.

/smartcard

Indicates whether the credentials are to be supplied from a smartcard. This parameter cannot be used with the /savecred parameter.

/showtrustlevels

Displays the trust levels that can be used as arguments to /trustlevel.

/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 name format should be <User>@<Domain> or <Domain>\<UserAccountName>.

/?

Displays help at the command prompt.

Remarks

Examples

The following command starts an instance of the command prompt as an administrator on the local computer:


Copy Code

runas /user:<localmachinename>\administrator cmd

When prompted, type the administrator account password.

The following command starts an instance of the Computer Management snap-in using a domain administrator account called contoso\domainadmin:


Copy Code

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

When prompted, type the domain administrator account password.

The following command starts an instance of Notepad (and a file named my_file.txt) using a domain administrator account called jayj in a domain called domain.contoso.com:


Copy Code

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

When prompted, type the domain administrator account password.

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


Copy Code

runas /netonly /user:<Domain>\<User_Name> "<Command>"

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

Additional references

Command-Line Syntax Key