Most of us have experienced a Windows service that has a status of "running" but is not doing what it is supposed to and we often restart the service. I would like to know if there is a way to determine if a Windows service is "functioning"? I don't mean it is "stopped", I mean how can I tell it is doing what it is supposed to in the "Running" state?
I found these previous questions below but these are oriented to developed Windows Service's and not a third party Windows Service installed with a software application or a core Windows Role\Feature service. I know the logs may say "service has entered the stopped state" but if it is not "stopped" but also not functioning is there a way I can tell?
How can I verify if a Windows Service is running
How do i know if my windows service is working?
CodePudding user response:
Sending SERVICE_CONTROL_INTERROGATE
with ControlService
to the service should force the services control handler to process the event. If the service control handler thread is blocked this will fail.
Beyond that I don't know if there is a generic way to determine if a service is functioning correctly.
If you are looking at a specific known service, you might be able to try any TCP ports it is listening on or named pipes it creates. A web server should respond to a HEAD request for / for example.