0

I have Windows service started from Local Service. This service can be installed on terminal windows server with multiple users. As I understand service started in "Session 0" and can not interact with users in easy way. What is the best way start another exe file for each user from this service? I think this another application can not be started from service directly. I can add via service add application in registry startup key and this application will start on next logon, but I not sure that it is the best solution

Sergey
  • 1
  • a service *simply shouldn't* be dealing directly with anything related to specific sessions; the "allow service to interact with desktop" option *still exists* but really should never be used; since Vista time? – Marc Gravell Mar 01 '18 at 14:30
  • A privileged service (e.g. running as SYSTEM) can start another process in any session, but that's not necessarily the best way. It's simpler to let the user session start the client application. – Eryk Sun Mar 01 '18 at 14:56
  • How start the client application in user session? Add to autorun for all users using service? – Sergey Mar 01 '18 at 15:38
  • You can start an app from a LocalSystem service using impersonation. See function ImpersonateLoggedOnUser for instance. Not especially simple technique though. – freim Mar 01 '18 at 18:07
  • you can use windows task scheduler please see [this way](https://stackoverflow.com/questions/5307968/how-can-i-run-an-exe-program-from-a-windows-service-using-c/51156657#51156657) . – Rahmat Anjirabi Jul 03 '18 at 14:16

1 Answers1

1

You have to create a separate app with a GUI and way of communication between them. There are many ways for this and each of them has benefits and drawbacks. So it depends stronly on your needs.

Just to mention a few:

  • Sockets

  • Named Pipes

...

Dieter Meemken
  • 1,937
  • 2
  • 17
  • 22