use this method for retrieving Service Installed or Not:
private static bool IsSerInstalled(string serviceName)
{
// get list of Windows services
System.ServiceProcess.ServiceController[] ser = ServiceController.GetServices();
// try to find service name
foreach (ServiceController service in ser)
{
if (service.ServiceName == serviceName)
return true;
}
return false;
}
Call this function/Method where do you want?
{
// get list of Windows services
System.ServiceProcess.ServiceController[] ser = ServiceController.GetServices();
// try to find service name
foreach (ServiceController service in ser)
{
if (service.ServiceName == serviceName)
return true;
}
return false;
}
if (IsSerInstalled("AdobeFlashPlayerUpdateSvc"))
{
MessageBox.Show("Yes");
}
else
{
MessageBox.Show("No");
}
Result: "yes"
{
MessageBox.Show("Yes");
}
else
{
MessageBox.Show("No");
}