As my client is not accustomed to using the windows services screen, I'm wondering what I do to get the type of startup of a service.
Asked
Active
Viewed 1,356 times
-1
-
please check this question: [https://stackoverflow.com/questions/133883/stop-and-start-a-service-via-batch-or-cmd-file](https://stackoverflow.com/questions/133883/stop-and-start-a-service-via-batch-or-cmd-file) – AMINCHAR Feb 25 '18 at 13:46
1 Answers
1
It is as simple as using the StartType property of the ServiceController
class :
ServiceController sc = new ServiceController("Simple Service");
Console.WriteLine(sc.StartType.ToString());
where "Simple Service" is the name of the service you want to get the details of.
More examples of using this class can be found here.

Peter Bons
- 26,826
- 4
- 50
- 74
-
-
Which option, `StartType`? If so, please upgrade your app .net version to .net 4.6.1. It is only available since then as stated in the docs. – Peter Bons Feb 25 '18 at 14:04
-
1