As a developer, there are many times where we may need to run a program in context of another user. For example, you may need to replicate an issue that a user encountered.
The RUNAS windows command line program is your friend. From the command line run the following command to launch a program in context of another user.
Note: the use of the /netonly switch. The user context is only switched during network communications. The rest of the time, the program operates in the “normal” user context.
runas /netonly /user:<DOMAIN><USERNAME> <PROGRAM_PATH>
E.g. Might not be the best example – but you get the point 🙂
runas /netonly /user:shane-desktopshane “C:\windows\system32\notepad.exe”
- How to: Deploy Azure Functions Using Github Actions - 4th October 2021
- Solved: Set SharePoint Person Field to Null in Power Automate - 16th September 2021
- Visual Studio: Generate Class From JSON String - 17th August 2021