CHKSPOOL

NT Spooler Service Monitor Script

Although NT 4 Terminal Server Edition has just about reached end of life, there are plenty of Terminal Server farms still up and running.  If you are responsible for a Terminal Server farm, you are no doubt well aware of the myriad of printing problems you may encounter.  Incompatible drivers, printer remapping, and blue screens caused by print drivers are just some of the issues you've probably encountered.  One that is somewhat less common, but can be a pain anyway is when the print spooler server stops responding - but still appears to be running.  Traditional monitoring tools do not catch this condition.  But opening the printer folder tells the tale.  The little NT flashlight waves back and forth in its endless quest to find the installed printers, never to be satisfied without administrative intervention.

I don't know if W2k suffers from this type of problem, but there is no reason CHKSPOOL wouldn't work in that environment.  I doubt it is needed though - Microsoft fixed a lot of the issues with rogue drivers in W2k to keep them from being able to bring down the server (i.e. running them in the kernel space.)

CHKSPOOL is my way of addressing this problem.  It is not the only way, I'm sure, but it is effective, and it meets my criteria of 1) avoiding random spooler restarts and 2) finding and resolving these failed spoolers.  It also logs the server, time, and date of the failure so you know when it has had to do its thing.  It is by no means perfect.  I don't run it as a service, although that would probably be the preferred way to run it.  But it has eliminated helpdesk calls due to spooler failures, and thus saved me about 20 calls from the helpdesk in the first month I have been running it.  It requires a couple of included utilities, and you are free to modify it to suit your needs.  If you do find it useful, all I ask is that you let me know!

Download it here.

Requirements

By default, CHKSPOOL uses LPT1 to print.  If you have a printer there, you'll need to modify CHECKER.CMD.

By default, CHKSPOOL uses the administrative C$ share to check for the existence of the successfully created test print file.

A printer must be setup to print to a specific file, and shared.  To do this, create a printer to print to a file.  After it is created, go back into the printer and change the port to the filename you desire.  By default, CHKSPOOL uses C:\CHKSPOOL.PRN.  Keep in mind that the spooler service must be able to write to this location.

Included Files

CHECKER.CMD - Script to actually print the test print, check for its existence on the target server, and take some action when it fails.  Modify this if you change the share name of the printer, the target test file name, or the share name of the printer.  Also modify this if you are using some other port other than LPT1.
CHKSPOOL.CMD - Looping script.  Enter the name of your target servers in here.
NETSVC.EXE - Windows utility to allow for stopping/starting services.
SPLRES.CMD - Script used to restart a failed spooler.
TEDGDATE.EXE - Ted Coffman's utility to put current time and date into environment variables.  Used to rename the log files so you know what server had a problem and when.  Look at the scripts to see how to use this.
TEST.PRN - Test file to print.  Also copied and renamed to generate the files that tell you when a server failed.
WAIT.EXE - Utility to delay time between runs.  Modify CHKSPOOL.CMD to change the delay between checks.