\[Editor's Note: Email your scripting solutions (400 words or less) to Reader to Reader at [email protected] Please include your script and phone number. We edit submissions for style, grammar, and length. If we print your contribution, you receive $100.\]
Most Windows NT administrators must monitor the status of network printers so that they can fix stalled print queues or release paused print jobs that are preventing subsequent jobs from printing. Although specialized tools are available to monitor the status of network printers, these tools are typically costly.
With the script CheckQueue.vbs, you can quickly and cheaply monitor the status of all the print queues on a given NT server in your domain. Every 15 seconds, CheckQueue.vbs outputs the status of the queues and data about the current item in each queue to your console. You can then compare the current time against the time the user submitted the job to determine whether a printer has stalled. CheckQueue.vbs is especially useful for administrators who must monitor a large number of printers in a WAN.
Listing 1 contains an excerpt from CheckQueue.vbs. You can find the entire script in the Code Library on the Win32 Scripting Journal Web site (http://www.win32scripting.com/). I also posted this script on my Web site at http://www.scripthorizon.com/.
I wrote and tested CheckQueue.vbs on an NT Workstation 4.0 running Service Pack 5 (SP5) and SP6a. To use this script, you must change the sDomain and sServer variables to your domain and server path. You must also install VBScript 5.0, Windows Script Host (WSH) 2.0, and Microsoft Active Directory Service Interfaces (ADSI) 2.5 on the machine from which you'll run CheckQueue.vbs. To end the script at any point, press Ctrl+Break.