If you don't want to work through the WMI query syntax, this may be a little
easier:
//required for using ServiceController
using System.ServiceProcess;
private bool ServiceExists(string serviceName)
{
ServiceController[] allServices = ServiceController.GetServices();
bool result = false;
ServiceController sc = null;
for (int i = 0; i < allServices.Length; i++)
{
if (allServices[i].ServiceName.ToLower() == serviceName.ToLower())
{
result = true;
break;
}
}
return result;
}
"Ann Marinas" <ma*******@hotmail.com> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
Hi, All!
I just would like to ask... Is it possible that you can detect whether a
Windows Service is existing or not? If this is possible, how can you
implement it?
Thank you!
A
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.668 / Virus Database: 430 - Release Date: 04/24/2004