0

I am trying to write a process monitoring service. This service should restart a Windows store app if it is not running.

Is it possible for Windows service to start desktop apps?

This works if I run it as a console app in C#

Process.Start("C://myapp.exe");

But when I use it in a service. Nothing happens.

Jake
  • 21
  • 3
  • Services start with a System Account that does not have any environmental variables. So any application that uses the environment does not run correctly. One way of solving issue is to create a service account. Then start the service using Run As (requires an admin to setup) using the service account. – jdweng Feb 27 '22 at 11:23
  • 1
    This may help you: [Stackoverflow](https://stackoverflow.com/questions/5307968/how-can-i-run-an-exe-program-from-a-windows-service-using-c) – gacaba3982 Feb 27 '22 at 11:26
  • @gacaba3982 Thank you for pointing out that post. One way I made it work is to change the service Log On to the account user. But this means I need to enter the username and password. Assuming there is only one user. Is there a way to do this programmatically? – Jake Feb 27 '22 at 22:55

0 Answers0