Managing Print Queues and Individual Print Jobs

 < Day Day Up > 



Several Windows scripts are available for working with print queues and the print jobs they contain. You use the Prnqctl utility to start, stop, or pause the printing of all documents in a printer queue. You use the Prnjobs utility to work with print jobs.

Viewing Jobs in the Queue

You can view jobs in print queues using Prnjobs. If you want to view all jobs for all printers on the local computer, type prnjobs –l. To view the jobs for a particular printer use the –P parameter to specify the printer name. For a remote computer, you can use the –S parameter to specify the remote computer you want to work with and if necessary use the –U and –W parameters to provide the user name and password required for access to the remote computer.

Consider the following examples:

View all print jobs on CorpSrv03:

prnjobs -l -s corpsrv03

View all print jobs for MainPrinter on the local computer:

prnjobs -l -p MainPrinter

The output for an individual job tells you the following:

  • Job ID The job identification number, which is needed when you want to work with individual print jobs.

  • Printer The name of the printer.

  • Document The document file name, which can include the name of the application that printed it.

  • Data Type The printer data type.

  • Driver Name The name of the print driver, which indicates the model of the printer.

  • Description The description of the printer.

  • Elapsed Time The length of time the document has been printing.

  • Job Status The status of the print job. Entries you’ll see include Printing, Spooling, Paused, Deleting, and Restarting.

  • Notify The person notified when the print job is complete (if notification is configured)

  • Owner The document’s owner.

  • Pages Printed The number of pages printed so far (if any).

  • Size The document size in bytes.

  • Time Submitted The time and date the print job was submitted.

  • Total Pages The total number of pages in the document.

Pausing the Printer and Resuming Printing

From time to time, you might need to pause a printer so that you can work with the physical print device or troubleshoot a problem. When you pause printing, the printer completes the current job and then halts all other jobs. You pause printing using Prnqctl. On a local printer, type prnqctl –z, using the –P parameter to set the name of the printer you want to pause. For a remote computer, you can use the –S parameter to specify the remote computer you want to work with and if necessary use the –U and –W parameters to provide the user name and password required for access to the remote computer.

To resume printing, use the –M parameter instead of the –Z parameter. This should restart printing of all documents in the print queue.

Consider the following examples:

Pause printing for EngineeringPrinter on CorpSrv03:

prnqctl -z -s corpsrv03 -p EngineeringPrinter

Pause print jobs for 5thfloorPrinter on the local computer:

prnqctl -z -p 5thfloorPrinter

Resume printing for EngineeringPrinter on CorpSrv03:

prnqctl -m -s corpsrv03 -p EngineeringPrinter

Emptying the Print Queue

You can use Prnqctl to empty a print queue and delete all of its contents. On a local printer, type prnqctl –x, using the –P parameter to set the name of the printer whose print queue you wish to empty. For a remote computer, you can use the –S parameter to specify the remote computer you want to work with and if necessary use the –U and –W parameters to provide the user name and password required for access to the remote computer.

Consider the following examples:

Empty the print queue for SalesPrinter on salespc06:

prnqctl -x -s salespc06 -p SalesPrinter

Empty the print queue for TempPrinter on the local computer:

prnqctl -x -p TempPrinter

If successful, Prnqctl reports that it successfully purged documents from the print queue. It will do so even if there are no documents in the print queue initially.

Pausing, Resuming, and Restarting Individual Document Printing

You can pause or resume printing of individual jobs as well. When you pause a job, you halt the printing of that document and let other documents print. When you resume a job, you tell the printer to resume printing the document from the point at which it was halted.

To pause a print job, you use the following syntax:

prnjobs -z -p PrinterName -j JobID 

where PrinterName is the name of the printer you want to work with and JobID is the ID number of the print job to pause.

To resume a print job, you use the following syntax:

prnjobs -m -p PrinterName -j JobID 

where PrinterName is the name of the printer you want to work with and JobID is the ID number of the print job to resume.

In either case, you work with printers on the local computer by default. For print queues on remote computers, you can use the –S parameter to specify the remote computer you want to work with and if necessary use the –U and –W parameters to provide the user name and password required for access to the remote computer.

Consider the following examples:

Pause printing job number 6 for EngineeringPrinter on CorpSrv03:

prnjobs -z -s corpsrv03 -p EngineeringPrinter -j 6

Pause printing job number 17 for 5thfloorPrinter on the local computer:

prnjobs -z -p 5thfloorPrinter -j 17

Resume printing job number 6 for EngineeringPrinter on CorpSrv03:

prnjobs -m -s corpsrv03 -p EngineeringPrinter -j 6

Prnjobs should report that it successfully paused or resumed printing of that job ID. If you use an invalid job ID, Prnjobs will report “unable to set the print job”.

Removing a Document and Canceling a Print Job

You can use Prnjobs to cancel an individual print job and delete it from a print queue. On a local printer, type prnjobs –x, using the –P parameter to set the name of the printer and –j to specify the ID number of the document to be deleted. For a remote computer, you can use the –S parameter to specify the remote computer you want to work with and if necessary use the –U and –W parameters to provide the user name and password required for access to the remote computer.

Cancel printing job number 12 for MainPrinter on the local computer:

prnjobs -x -p MainPrinter -j 12

Cancel printing job number 9 for EngineeringPrinter on CorpSrv03:

prnjobs -x -s corpsrv03 -p EngineeringPrinter -j 9

If successful, Prnjobs reports that it successfully cancelled the print job. If you use an invalid job ID, Prnjobs will report “unable to set the print job”.

Note

If a document is printing when you cancel it, the print device may continue to print part or all of the document. This is because most print devices cache documents in an internal buffer, and the print device may continue to print the contents of this cache.



 < Day Day Up > 



Microsoft Windows Command-Line Administrator's Pocket Consultant
MicrosoftВ® WindowsВ® Command-Line Administrators Pocket Consultant
ISBN: 0735620385
EAN: 2147483647
Year: 2004
Pages: 114

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net