I have created a windows service say XYZ. I could set its properties that is "startup type" and the "recovery".My question is how to get its current settings.
I want to "get" its
1.Startup Type
2.Recovery
2.1 First failure
2.2 Second failure
2.3 Subsequent failure
Loading
Jithin JosePosted Jan 22, 2016, 12:16 AM
Cassie ModPosted Jan 21, 2016, 11:36 AM
ServiceController[] scServices = sc.DependentServices;
// Display the list of services dependent on the Event Log service.
if (scServices.Length == 0)
{
Console.WriteLine("There are no services dependent on {0}",
sc.ServiceName);
}
else
{
Console.WriteLine("Services dependent on {0}:",
sc.ServiceName);
foreach (ServiceController scTemp in scServices)
{
Console.WriteLine(" {0}", scTemp.DisplayName);
}
}