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.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}