Check Status of Service in VB.Net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a VB6 app that uses API calls to check that status of certain
Services. I am converting this app to VB.Net and wondering how to accomplish
this same functionality in VB.Net.

Any ideas?
 
Hi,

Dim s As System.ServiceProcess.ServiceController

For Each s In System.ServiceProcess.ServiceController.GetDevices

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

Trace.WriteLine(strOut)

Next



Ken

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

I have a VB6 app that uses API calls to check that status of certain
Services. I am converting this app to VB.Net and wondering how to
accomplish
this same functionality in VB.Net.

Any ideas?
 
Thanks Ken. Very helpful. That gave me 99% of what I needed, but I have one
more question.

How can I tell if a service is "hung"? I know I can check the status which
will tell me whether it is running or not, but I need to be able to determine
if the service is responding. Does this make sense?

Thanks so much for your help. Very much appreciated.

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top