Programmatic way to tell when a service is stopped?

S

Steve

Is there a programmatic way to tell when a windows service is stopped.

I would like to be able to issue a command from a programming language
and get back some sort of result that would let me know when a windows
service is down.

Thanks in advance for any information
 
P

Pegasus \(MVP\)

Steve said:
Is there a programmatic way to tell when a windows service is stopped.

I would like to be able to issue a command from a programming language
and get back some sort of result that would let me know when a windows
service is down.

Thanks in advance for any information

Try this for the Windows Spooler service:

net start | find /i "Print Spooler" > nul

Now get your program to monitor the return code for
this command. It is 1 when the spooler is down.
 

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

Top