Starting a Service from a program.
I need to make sure a service is running on the computer, and if it isn't, my program need to start the service.
Now, I've already got my program to successfully detect whether the service is running or not, the problem I have is getting the service started on Vista.
I have tried two methods to start the service.
Method 1:
ServiceController myService = new ServiceController("ThisIsMyService");
myService.Start();
Method 2:
System.Diagnostics.Process.Start("Net", "Start \"ThisIsMyService\"");
In XP, I can simpily use myservice.Start() or I can use Net Start "myService". Both of these work. However under Vista, myservice.Start() gives me an InvalidOperationException and Net Start "myService" gives me a System Error 5 message.
Is there any way to get my program to start the service it needs? (I don't really care if it pops up warnings or asks for the admin password before starting the service, just so long as it actually starts.)
The program is written in C#.
Thanks,
Munty.

