How To: Detect Hung Services

| | No TrackBacks
Certain Windows services may misbehave and can hung (respond no longer). It may be quite tricky to determine the actual service state.

A Windows service may be in one of four states:
SERVICE_STOPPED
SERVICE_START_PENDING
SERVICE_RUNNING
SERVICE_STOP_PENDING


When a service is stopped, its state through services.msc control panel applet
and from net.exe command will both report it as stopped. When it's running,
they both will report it as running. However, when a service is in a pending state,
it will be reported as running as well.

The solution is to use sc.exe from Resource Kit and use its query syntax to determine the
actual service state, i.e.

sc.exe query servicename

It will return the true service state. Also, the sc.exe can be used to control, create,
modify or delete service, as well, thus providing all the necessary interface in command-line mode. IPHost Network Monitor.

No TrackBacks

TrackBack URL: /blog/mt-tb.cgi/60

blog comments powered by Disqus

About this Entry

This page contains a single entry by Konstantin Boyandin published on January 15, 2010 3:57 PM.

How To: Display Windows Service Not Running was the previous entry in this blog.

Hidden Partition May Make Setup Fail is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.