By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,989 Members | 2,392 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,989 IT Pros & Developers. It's quick & easy.

Loop though services

P: n/a
I am trying to loop thought all the services on a system and stat/stop
then as needed, I know How I can start or stop then, but how do I loop
thought all installed services.

Thanks
Mike
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Mi**@walterscentral.com (Mike Walters) wrote in
news:1e**************************@posting.google.c om:
I am trying to loop thought all the services on a system and stat/stop
then as needed, I know How I can start or stop then, but how do I loop
thought all installed services.

I use WMI to loop through the services as well as start and stop.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2

P: n/a
Hi,
Dim s As System.ServiceProcess.ServiceController

For Each s In System.ServiceProcess.ServiceController.GetService s

Dim strOut As String = String.Format("{0} {1} {2}", s.ServiceName, s.Status,
s.ServiceType)

Trace.WriteLine(strOut)

's.Stop to stop

's.Start to start

's.Pause to pause

Next

Ken

----------------------

"Mike Walters" <Mi**@walterscentral.com> wrote in message
news:1e**************************@posting.google.c om...
I am trying to loop thought all the services on a system and stat/stop
then as needed, I know How I can start or stop then, but how do I loop
thought all installed services.

Thanks
Mike
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.