1

Doing one of my first times of creating a script to do an automatic recovery and ran into an issue.  I think I have a solution but want to run it past some people smarter than me at this.  Issue is in a service that runs a printspooler for one of our applications it has a tendency to get hung up and stop processing jobs.  I have a performance counter that detects the number of jobs in the que and sends a critical alert if the number gets too high.  What I was attempting to do was to watch this and then when the issue occurs to run a script that will restart the service an that will get printing going again.  When I tried this out of the box what happened was the service kept just restarting every few seconds.  I suspect that what was happening was that it kept seeing the service as in a critical state as the jobs had not yet cleared the que so it kept just rerunning the script.  My first thought was to put in a delay at the end of 2 minutes so that the script would not exit until that happened which would give it time to process some print jobs and set the counter back to a good condition.   What I need to know is does this sound like it would work or would it just keep running multiple instances of the script which would also keep jobs from processing.   I just loaded up squaredup’s powershell management which should make this script way simpler than the vb script I found online.

rtbywalski selected answer