Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Contolling windows Services with .bat files

Status
Not open for further replies.

Belcherman

Programmer
Aug 13, 2005
1
US
I am trying to figure out how to shutdown completely and restart or stop or start windows services via .bat files. I would call this bat file from asp.net. I already can stop or start a service with asp.net but the issue is when the service crashes it is technically STILL RUNNING so stopping or starting it doesnt seem to do anything and it remains not working. I need a way to completely unload the service and start it brand new again like when you reboot but with out rebooting. How can I do this?
 
Don't think there is much you could do command line wise regarding services. But you could try to use the parameters for the Service in conjunction with your batch file. If you check the properties of the service (the Recovery Tab in the services applet) there are options to perform certain tasks upon failure. Since I am no programmer, you could probably try to find a "hook" into using the Recovery tab option.
 
You need to figure out what processes each service is using, and kill the process when it's in a hung state. pslist and pskill from the psutilities at would help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top