Elevate privileges as a different user
Have you ever needed to start a program as a different user AND as an administrator at the same time? This can be a challenge in a Windows enterprise environment where UAC is configured either to:
- prompt for consent for admin users (as opposed to “prompt for credentials”)
- automatically deny attempts to elevate privileges for non-admin users
I have often missed having the possibility of right-clicking a program and then selecting “Runas as another user as administrator”. But this is unfortunately not available in the Windows 10 UI.
So what to do? Well here’s one way to get around this problem.
Find the powershell.exe file or a shortcut to PowerShell, hold SHIFT and right-click and select “Runas as a different user”. By the way, you can’t do this from the Windows 10 start menu.
Then type the credentials of the account with which you want to use. Now you have a PowerShell session running as this user. Next step is to elevate the privileges for a program of your choice. You can do this by running the command shown below (for example cmd.exe):
1 |
Start-Process cmd.exe -verb runas |
Enjoy your elevated CMD prompt 🙂