![]() ![]() ![]() But there is also a PowerShell equivalent that we can use to run PowerShell scripts and commands as a different user. The runas command is old and can be used in PowerShell. For example, it’s not possible to open explorer or printers as administator (there is a workaround though). Some programs can’t be opened as a different user. But when you want to run these applications as a different user, you will need to specify the full path of the applications: Runas /user:administrator "C:\Program Files\Google\Chrome\Application\chrome.exe" When you type chrome.exe in the run dialog (Windows key + R), the application will open. Runas /user:administrator "MMC services.msc" Open a program as another user You will need to add MMC in front of the command: # Open services.msc If you want to open the services.msc as administrator you can’t simply specify services.msc as the program parameter. Runas /user:lazyadmin\administrator cmd Open an MMC console as admin You can either use the local admin account or the domain admin account for this. Run as (domain) administratorĪ common use case for the command is to execute programs or open administrative tools with administrator privilege. RunAs Examplesīelow I will give you a couple of examples of how to use the runas command. So be really careful when using this option. There is nothing to stop the user or other programs from using these credentials for another task. Now, this might seem useful for scripts etc, but it’s basically a big security risk. The parameter /savecred stores the credentials (username and password) in the user’s profile under %appdata%\Microsoft\Credentials. The /user: parameter is of course required and specifies the user that you want to run the command as. The command always starts with the parameters that you want to use, follow by the command that you want to execute. Use this option if you are using smart cards for authentication Save the password in the user’s profile so it can be used later (security risk!) Use the current network environment instead of user’s local environment Specifies the user account that you want to useĭon’t load the user’s profile, this will make the application load faster. There are a couple of parameters that we can use with the runas command: Parameter With the basics explained, lets take a closer look at the different options we have. Runas /user:admin cmd runas administratorĪfter you have typed the command, you will be prompted for the password after which the command will be executed. To open the command prompt as administrator we only need to specify the user, in this case, the local admin account, and the program that we want to run, cmd in this case. But before we dive into the different options, let’s first take a look at a quick example of how to execute a command as administrator. The RunAs command comes with different parameters that we can use to execute programs as a different user. In this article, we are going to take a look at how to use the Runas command. But the command is not limited to admins, you can also use the command to execute programs as another user. Which is basically the same behavior.Īdministrators often use runas to execute commands or other tasks with admin privileges while they are logged in to an account without administrator privileges. You can often right-click on a program in the user interface and select “Run as administrator”. Runas can be used on all Windows versions and dates back to Windows 2000. The command RunAs can be used to execute programs and commands as a different user than the one signed in. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |