You can also use Devexec to run a process under any user's credentials.
||15 November, 2011
Because of security reasons creating a new process from Windows service isn't a simple task especially if you need to run an application with GUI on Windows 2008/Windows Vista/Windows 7 under specific user account.
DevxExec is designed exactly to run application from a windows service. Using DevxExec you can run applications from your service under Local System, Network Service or a specific user account.
There is even possibility to specify a session for the running application. Thus when multiple users connected to the computer via remote desktop you can specify on which desktop the application should be started.
It has command line interface. To see the help, run DevxExec with no parameters.
DevxExec is free for noncommercial usage.
DevxExec.exe /user: Administrator /password:qwerty cmd.exe
This command automatically grant to user Administrator permissions on the appropriate window station and the desktop and run a command shell.
Let's consider following scenario. You have a Windows service running. User John Doe has logged to the computer. And you want your service to start the application that will be shown to John Doe on his current desktop. In other words, you need to run a new process in another session.
Again you can use DevxExec. It has a special parameter /sessionid to specify the session you what to run a new process in. For example this command could start a command shell for a logged in user under Administrator.
DevxExec.exe /user: Marcus /password:qwerty /sessionid:1 cmd.exe
Devexec is the tool the allowing running processes under different user accounts without knowing the password.
It is even possible to run a process under domain account without specifying its password!
You can use Devexec to run a process under SYSTEM, NETWORK_SERVICE, TrustedInstaller in an interactive session.