Use PowerShell to view pending print jobs

by Mitch Tulloch [Published on 23 Oct. 2014 / Last Updated on 23 Oct. 2014]

This tip shows how you can use Windows PowerShell to view information about pending print jobs.

Using the Get-Printer cmdlet as follows indicates that one of the printers on HOST7 has Error for its status:

PS C:\> Get-Printer -ComputerName HOST7 | where PrinterStatus -eq Error | `
fl Name,JobCount

Name    
: HP LaserJet 5200 PCL6
JobCount : 3

To view more information about the cause of this error, you can use the Get-PrintJob cmdlet like this:

PS C:\> Get-PrintJob -ComputerName HOST7 -PrinterName "HP LaserJet 5200 PCL6"

Id   ComputerName   PrinterName     DocumentName   SubmittedTime       
JobStatus
--   ------------   -----------     ------------   -------------       
---------
3    HOST7          HP LaserJet ... Document 3    
8/26/2012 2:08:06 PM Error, Print...
4    HOST7          HP LaserJet ... Document 2    
8/26/2012 2:08:06 PM Normal
5    HOST7          HP LaserJet ... Document 1     8/26/2012 2:08:06 PM Normal

The first print job in the queue (job #3) is generating the error condition. You can find out more information about this job as follows:

PS C:\> Get-PrintJob -ComputerName HOST7 -PrinterName "HP LaserJet 5200 PCL6" | `
where Id -eq 3 | fl JobStatus,UserName

JobStatus : Error, Printing, Retained
UserName  : kberg

The fact that the job status includes Retained suggests that either the print job is corrupted or the print device is offline or out of paper. Either way, user Karen Berg should probably be informed because the print job belongs to her. 

The above tip was excerpted from Mitch Tulloch's book Training Guide: Installing and Configuring Windows Server 2012 from Microsoft Press.

Mitch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows administration, deployment and virtualization.  For more information see http://www.mtit.com.

See Also


The Author — Mitch Tulloch

Mitch Tulloch is a well-known expert on Windows Server administration and cloud computing technologies. He has published over a thousand articles on information technology topics and has written, contributed to or been series editor for over 50 books.