Installed Windows Services in C#

 

 

 

 

 

 

 

 

 

 

The following code checks whether a windows services installed on your machine or not.

public static void ISWindowsServiceInstalled(string serviceName)
{
    // get list of Windows services
    ServiceController[] services = ServiceController.GetServices();

    foreach (ServiceController service in services)
    {
        if (service.ServiceName == serviceName)
            return true;
    }
    return false;
}

Copyright © All Rights Reserved - C# Learners