Get List of Windows Services

Posted by Prabhukiran345 under C# category on | Points: 40 | Views : 854
To get list of all services (which are not device drivers) use static method ServiceContro­ller.GetServi­ces (to get list of driver services use method ServiceContro­ller.GetDevices).

ServiceController[] services = ServiceController.GetServices();

Check whether a service is installed:
public static bool IsServiceInstalled(string serviceName)
// get list of Windows services
ServiceController[] services = ServiceController.GetServices();

// try to find service name
foreach (ServiceController service in services)
if (service.ServiceName == serviceName)
return true;
return false;

Comments or Responses

Login to post response