Run a program in context of another user

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”

Command Line - RUNAS

Shane Bartholomeusz

G’day, I’m a technical solutions consultant based in Perth, Australia that specialises in the Microsoft technology stack, including .NET, Dynamics 365, Azure and general web development etc.

This blog is my place to share my thoughts, helpful solutions and just random nerdy stuff.
Shane Bartholomeusz

Latest posts by Shane Bartholomeusz (see all)

One thought on “Run a program in context of another user

  1. I don’t know if it’s just me or if everybody else experiencing issues with your blog.

    It seems like some of the text on your content are running off the screen. Can somebody
    else please comment and let me know if this is happening to them as well?
    This might be a problem with my web browser because I’ve
    had this happen before. Appreciate it

Leave a Reply