How do you make your stop/start service scripts gracefully handling the services that get stuck in STOP_PENDING or START_PENDING...
Related with SC STOP and START. Stop and Start a service via batch or cmd file?
I have one aproach in mind, but I don't like it.
This is the way i'm approaching the stop.
First open service.msc, in the properties dialog for your targeted service go to the Recovery Tab *(run -> services.msc -> right-click Target-Service -> Properties -> Recovery tab*)
Make sure the First\Second\Subsequent failures are all set to : Take No Action.
Get the PID of your target service using: sc queryex ServiceName:
Kill the process using taskkill /f /pid your_PID_number
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With