Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Installed Windows Services in C#

DZone's Guide to

Installed Windows Services in C#

·
Free Resource

















The following code checks whether a Windows service is 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;
}

 

Topics:

Published at DZone with permission of Amir Ahani, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}