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
How to "get" current settings of a windows service
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Cassie ModRank #3,821 · 387 reputationPosted Jan 21, 2016, 6:36 AM EST
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);
}
}
Jithin Jose4 reputationPosted Jan 21, 2016, 7:16 PM EST