Print spooler management
This is a script I had to dig out again recently so I thought I'd share it for anyone in a similar position.
I have a few schools where the teacher sends a really big job that just b*ggers everything up or the spooler dies because of some driver clash (or similar) so again the printers just stop showing up and nobody can print.
Whatever it is, you obviously don't want the spooler sat there with jobs piling up like a stream of abandoned cars on the M11.
Enter my script, and how it works is this...
You have one custom variable "StallTime" which you can define in the script. (The script will assume a stalltime of 20 minutes if you don't set one)
This is the "line" that the script will use as a measure as to whether a job has stalled and requires action.
The process works as follows:
1. Are the Spooler and LPDSVC services are running... If not it will start them
2. Is the current job older than the stalltime value with a status of "printing"? If yes it stops the services, kicks the first job then restarts the services again.
It is possible to have the script restart the queue leaving the first job to try again but I found that had unintended consequences with staff submitting huge print jobs being restarted. The fact that they were hogging the printer was irrelevant at the time.
Now the script just kicks their job off the system if it's still going after (in my case) 10 minutes.
To use this as an automated script, simply add it to the scheduled tasks and set it to run every 10 minutes. I usually start and stop it at 8:45am and 15:30pm so that staff can print their biiig jobs before or after school (You see I can be nice occassionally) ;)
Hope this one helps..