I’m devloping one application which manages our custom made windows service. I’m using ServiceController object to get all services, but after that how I will differentiate which is our custom service and which is system service?
I am using following code:
ListViewItem datalist;
services = ServiceController.GetServices();
ServiceList.Items.Clear();
foreach(ServiceController service in services)
{
datalist = new System.Windows.Forms.ListViewItem(service.ServiceName.ToString());
datalist.SubItems.Add(service.DisplayName);
datalist.SubItems.Add(service.Status.ToString());
ServiceList.Items.Add(datalist);
}
Put the name of your services in
app.config. And read those when your application is started.You can use http://csd.codeplex.com/ to create a custom configuration section.