Link to home
Start Free TrialLog in
Avatar of GeekMan
GeekMan

asked on

NT Services monitoring with VB

I would like to use a VB app that monitors particular services in windows NT 4.0. If the service dies, then I would like to be able to automatically restart it. Is this possible?
Avatar of ndb
ndb

Let me know if someone answered. I asked almost the same question.
Avatar of GeekMan

ASKER

If I cannot do that, I would at least like to be able to detect the service's status (started or stopped).
ASKER CERTIFIED SOLUTION
Avatar of Torus
Torus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GeekMan

ASKER

Wow...This is great. Thank you very much..
Avatar of GeekMan

ASKER

One question, don't I have to declare "STANDARD_RIGHTS_REQUIRED" as a constant? What should it's Hex value be, or does it matter??
Sorry, missing. Here you are!

Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Avatar of GeekMan

ASKER

I've got it working..I've noticed something interesting points in doing so. Unless I'm doing something wrong, the service names must not have any blanks in them when passed to the OpenService function(ie. a Service that displays as "Directory Replicator" must be passed to the function as: "DirectoryReplicator") I also found that not all Services are created equal. Some are displayed differently(particularly 3rd party services) than how they are recognized internally.
In one particular case I had a Service displayed as: "DmNet Listener Server" what worked internally was: "DmNetListenerService"...a little strange I thought..
oh! Thank you for telling your experience here. Actually, I don't know the service name passed to the function should not have space.