Link to home
Start Free TrialLog in
Avatar of garychu
garychu

asked on

Setting up notification of an NT service state

I use a command;
net start "<service-name>" to start and
net stop "service-name>" to stop the service.
I do this in a batch file, scheduled to run unattended.
Are there command(s) I can include in the batch file to check if the service starts/stop successfully? Such that if a return code is detected, I could then use a utility, say, Postie to email out notifications to individuals.
Given the objective, would this be so old world, and that there are more contemporary ways of doing so?
Thanks, Experts.
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

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
SOLUTION
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
thanks bill.  out and about still today and tomorrow too.... Paid work so cant knock it ... So not much time to be here.

i hadnt seen that list of error codes before for net.exe so is useful here too.

Should be able to use sc.exe too if available i suppose.

Garychu -has that given you enough between us (pls split points of course) or need some more clarification?

steve
Avatar of garychu
garychu

ASKER

Thanks, Experts.
I am grateful for the trouble taken and the benefits of knowledge and experience shared.
I think I now have enough to try out a few things before coming to a final solution.
Cheers
No problem.... Just ask another q if you need more and we'll see it.