I have a console app that displays information about the services on a computer using the ServiceController class.
The only thing I cannot pull is the Startup Type, e.g., Manual, Automatic.
using System;
using System.ServiceProcess;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
ServiceController[] sController = ServiceController.GetServices();
Console.WriteLine("Running Services");
Console.WriteLine("----------------");
foreach (ServiceController sc in sController)
{
Console.WriteLine(sc.ServiceName);
Console.WriteLine(sc.Status);
Console.WriteLine(sc.ServiceType);
Console.WriteLine(sc.DisplayName);
Console.WriteLine(sc.ServiceType);
Console.WriteLine("----------------");
}
Console.ReadLine();
}
catch (Exception ex)
{
// handle ex
}
}
}
}
Anyone know how to display the Startup Type of a service ?
Thanks