How to get all running services in C#?
c#, windows, winforms
Solution
From link here:
To get list of all services (which are not device drivers) use static method ServiceController.GetServices (to get list of `driver services` use method ServiceController.GetDevices).
ServiceController[] services = ServiceController.GetServices();
You can get the status for all services in a dictionary like this:
ServiceController[] services = ServiceController.GetServices();
var servicesStatus = services.ToDictionary(s => s.ServiceName, s => s.Status);
Problem
How can I get a list of all services installed on the system with their current status? I am not looking for the list of processes using `Process` class in C#, I am looking for the services.