Freigeben über


Run a program with administrative credentials

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

To run a program with administrative credentials

  • Using the Windows interface

  • Using a command line

Using the Windows interface

  1. In Windows Explorer, or on the Start menu, right-click the program executable file (or icon) that you want to open, and then click Run as.

  2. Click The following user.

  3. In User name and Password, type the administrator account name and password.

Notes

  • The use of Run as is not limited to administrator accounts.

  • You can use Run as to start a program in the context of an administrator account. The administrator context is only used for that specific program and is only available until that program is closed.

  • You can also use Run as to start two separate instances of an administrative application, such as Active Directory Domains and Trusts. Each instance can be directed at a different domain or forest to more efficiently perform interdomain or interforest administration tasks.

  • You can open most Control Panel items using Run as by holding down the SHIFT key, and then right-clicking the item.

  • Some programs do not support Run as.

  • If you try to start a program, such as Microsoft Management Console (MMC) or a Control Panel item, from a network location using Run as, it could fail if the credentials used to connect to the shared resource are different from the credentials used to start the program. The credentials used to run the program might not be able to gain access to the same shared resource. For more information about troubleshooting the runas command, see Related Topics.

  • If Run as fails, the Secondary Logon service may not be running. For more information about how to start a service, see Related Topics.

Using a command line

  1. Open Command Prompt.

  2. To run a program, type:

    runas/user:UserName"ProgramNamePathToProgramFile"**

Value Description

UserName

Specifies the user credentials to use when running the specified program. You can use the format user@domain or domain\user.

"ProgramName PathToProgramFile"

Specifies the program name and path to the program file name that you want to open with the specified user credentials.

For example, to open Active Directory Users and Computers, use the following format:

"mmc %windir%\system32\dsa.msc"

To open a specific file using Notepad, use the following format:

"notepad c:\myfile.txt"

Notes

  • To open a command prompt, click Start, point to All programs, point to Accessories, and then click Command prompt.

  • The use of the runas command is not limited to administrator accounts.

  • You can use the runas command to start a program in the context of an administrator account. The administrator context is only used for that specific program and is only available until that program is closed.

  • You can also use the runas command to start two separate instances of an administrative application, such as Active Directory Domains and Trusts. Each instance can be directed at a different domain or forest to more efficiently perform interdomain or interforest administration tasks.

  • Some programs do not support the runas command.

  • If you try to start a program, such as Microsoft Management Console (MMC) or a Control Panel item, from a network location using the runas command, it could fail if the credentials used to connect to the shared resource are different from the credentials used to start the program. The credentials used to run the program might not be able to gain access to the same shared resource. For more information about troubleshooting the runas command, see Related Topics.

  • If the runas command fails, the Secondary Logon service may not be running. For more information about how to start a service, see Related Topics.

Information about functional differences

  • Your server might function differently based on the version and edition of the operating system that is installed, your account permissions, and your menu settings. For more information, see Viewing Help on the Web.

See Also

Concepts

Troubleshooting Local Users and Groups
Why you should not run your computer as an administrator
Runas
Using Run as
Why you should not run your computer as an administrator
Differences in default security settings
Default security settings for groups
Start, stop, pause, resume, or restart a service
Create a shortcut using the runas command