ServiceController[] to access multiple machines
Hi Guys,
I'm after some assistance / guidance, I am trying to create an application to control windows services i.e stop / start across multiple servers simultaneously. There is probably more then 200 services across 20 servers.
I came across the System.ServiceProcess.ServiceController class and want to be able to pass multiple machines to the GetServices() method but can only pass one machine.
i.e
while
(dataset.read())
{
string ipaddress = dataset["ipaddress"].ToString()
ServiceController.GetServices(ipaddress);
foreach(ServiceController services in ipaddress);
{
services.Stop();
}
}
Is there any way around this or alternatively another class method to be able to do this?
The machines ip's and the services on the machine are from a SQL query dataset that I need to pass.
Not sure how else to access Windows services?
Thanks in advance