I know this has been handled before but I'm not getting a clear answer from this question.
I have a service that depends on the print spooler.
Every now and then, the spooler crashes...(luckily not often)...
I need to stop that service when the spooler service crashes.
I'm not sure if adding dependency for Spooler to my service will do just that?
I tried using recovery option "Run Program" and use some script to stop the service but
I don't fully trust that... (getting "Access Denied" errors)
Thank you for your advice.
The dependencies between services are used to determine the order in which the services are started. So if your service A depends on service B and you have set that dependency, the system makes sure that service B is started before service A.
Also if a service you depend on is disabled, your service can not start. While when it is set to manual start, it may be started by the system if needed.
The dependencies have no effect when one of the services fail.
You should try setting the 'Run Program' recovery option on the 'Print Spooler' service. The script to run should then restart your service.
You have to make sure that who-ever runs the script has enough permissions to restart (start/stop) your service.
It seems the script is started under the same user account that runs the service that failed. Because 'Print Spooler' usually runs under 'Local System', by default it should have enough permissions to restart your service.
You have to investigate why you are getting 'Access Denied' errors. You could add
'whoami /all'
to your script and redirect the output to a file.If you need to set permissions of your service, check this SF question