Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Monitoring individual print jobs allows you to retrieve detailed information about each print job on a print server. In turn, this information allows you to:
For example, a user might call the Help desk complaining that a document has not been printed. By examining the print job status, a technician might notice that the document has been paused or that it has a low priority compared with other documents in the queue. In the latter case, this means that the document will not be printed until all the higher-priority jobs have completed.
You can use the Win32_PrintJob class to retrieve detailed information about every print job on a print server.
Listing 13.8 contains a script that monitors print job status. To carry out this task, the script must perform the following steps:
This query returns a collection consisting of all the print jobs on the computer.
The Name property is a combination of the name of the printer where the job is queued and the ID number assigned to the print job. For example, a print job assigned ID number 522 on the printer ColorPrinter would have the following name:
ColorPrinter, 522
The VBScript Split function is used to split the printer name and the print job ID into an array. In this script, the Split function uses the following parameters:
When the Split function is called, the print job name will be split into an array with two elements: Element 0 will contain the name of the printer, and element 1 will contain the job ID. To reference the printer name, simply specify element 0 in the array. For example:
Wscript.Echo strPrinter(0)
Listing 13.8 Monitoring Print Job Status
|
|
Send us your feedback | « Previous | Next » |