Sometimes, you need to execute some commands as another user but while keeping administrator privileges. This can be useful if you manage a Windows Server, for example.
To do this, simply follow these steps:
- Run a CMD with administrator privileges
- Type
runas /netonly /user:DOMAIN\USERNAME cmd
(ReplaceDOMAIN\USERNAME
with the targeted user values)
Windows will ask you the user password then will launch a new CMD window that has the administrator privileges while using the other user account:
Example using Powershell instead of CMD:

As you see, it does work too with Powershell. This means that if you want to launch Notepad instead of CMD or Powershell, you can do it too!