Command Prompt IconA little while ago I wrote an article on launching a process in another Terminal Session (

The article didn’t have a demo app yet so I’ve attached it here.

How do you use it?

It’s a commandline tool and it’s called RunInSession. You need to specify at least the SessionId in which you want to launch the process and which process you want to launch. Optional is servername if you want to launch on a remote server. If you run it without parameters a dialog with possible parameters is shown:

Run In Session Screenshot

Currently supported OS versions are Windows XP, 2003, Vista and 2008.

How does it work?

The program needs to run in the context of the Localsystem user, therefore it temporarily installs itselfs as service and start itsself. With the WTSQueryUserToken it obtains the Primary User token of the requested Terminal Session. Finally the process is launched with CreateProcessAsUser and the service deletes itsself. (2094)