Run a UserProcess from Windows service in user Desktop

Windows Service

I have been wondering is there any easy method to start a process on user desktop from a windows service for a long time. During my research i came across a lot of security issues like system process blah blah etc… finally i got it working using some win32 API like

  • WTSGetActiveConsoleSessionId
  • WTSQueryUserToken
  • CreateProcessAsUser

i wrote a c# wrapper class for simplicity  and it will be like


first argument is the executable, second is the command line argument , third boolean argument determine weather to hide the window.

  • false: will show the window.
  • true: will hide the window.

Remember this can be done only a service running with SYSTEM privileges.(Logon account as LocalSystem).




Download the Library and add a reference to it