You can use:
using System.ServiceProcess;
And then bind the service you want to view with:
// Link by service name ServiceController TheServiceName = new ServiceController(); TheServiceName.ServiceName = "Spooler"; // Link by display name ServiceController TheDisplayName = new ServiceController(); TheDisplayName.ServiceName = "Print Spooler";
To check, for example, isRunning Status:
if (TheServiceName.Status == ServiceControllerStatus.Running) MessageBox.Show("The service is running.");
source share