We’ve detailed how to use the Runas command, common use cases and examples, parameters, and related errors in the article below.
How to Use Runas Command as an Administrator
The Runas Command is commonly used with the /user parameter to perform tasks as an administrator. We’ve listed some useful Runas command examples below.
First, let’s look at the syntax. You can copy either of the following formats and replace the device and account name with your own credentials:Runas /user:AdminAccountName@DeviceNameRunas /user:DeviceName\AdminAccountNameIf you’re trying to access a domain administrator account, you should use the DomainName instead, as shown below:Runas /user:AdminAccountName@DomainNameRunas /user:DomainName\DomainAdminName
You can use the runas command to open .exe files, .msc files, Control Panel items, and shortcuts to programs and saved MMC consoles. We’ve listed the syntax to do so and a few examples below.
The following command uses the filename to launch a command prompt window as an administrator:Runas /user:DeviceName\AdminAccountName filename The following command uses the file path to launch an application as an administrator:Runas /user:DeviceName\AdminAccountName “filepath” The following command launches Computer Management using a domain administrator account:Runas /user:DomainName\DomainAdminName “mmc %windir%\system32\compmgmt.msc” The following command opens a text file in a domain using Notepad. It uses a domain admin account named Jacques in a domain called domain.tnt.com to open a file named file1:Runas /user:jacques@domain.tnt.com “notepad file1.txt”
Runas Command Parameters
In addition to /user, there are a few other switches that can come in handy. We’ve concisely explained their functions below./noprofile – The user’s profile is loaded by default, but this option specifies it shouldn’t be loaded./env – This option specifies to use the current network environment instead of the user’s local environment./netonly – This option indicates that the specified credentials are for remote access only./savecred – This option specifies to use credentials previously saved by the user./trustlevel – This option specifies the authorization level to run the program at./showtrustlevel – This option lists the trust levels that can be used as arguments to /trustlevel.We recommend checking Microsoft’s Runas documentation for the full list of parameters.
Related Questions
How to Fix ‘This Program is Blocked by Group Policy. For More Information, Contact Your System Administrator’ Error?
You can resolve this error with the following steps:
How to Find Device Name, Domain Name, and Admin Account Name?
Here are the steps to find these credentials:We also have an article on how to remove a computer from domain. You might find it a good read if you work in a domain.
How to Fix ‘The Requested Operation Requires Elevation’ Error When Using Runas Command?
First, you could use the /showtrustlevel parameter to check if you can elevate the trust level, and if it’s possible, you can do so with the /trustlevel parameter.In cases where you’re unable to elevate the trust level any higher, you can apply a workaround. You can enable the default admin account with the following command:net user administrator /active:yesThis account has higher privileges than a user-created admin account, so you’ll be able to use the runas command without any issues.