In one of the previous articles, we have seen how to manage printers from command line using some vbs scripts. In this article, I am going to explain how to manage the printer jobs using WMI command. We will learn how to pause the printer jobs, how to resume the paused jobs, how to delete the stuck up printer jobs.
First, let’s see the list of jobs we have in the queues. For this you need to run the below command.
wmic printjob get
The above will list all the jobs in progress/queue. It prints lot of details about each printer job. To print only the minimal information we are interested in, we can use the below command.
wmic printjob get jobid, document, jobstatus
Example:
c:\>wmic printjob get jobid, document, jobstatus Document JobId JobStatus BankStatement 2 Error/Restart
Cancel print job
You can cancel a print job using the below command. We need to provide the job id in the command.
wmic printjob where jobid=<jobnumber> delete
Example:
wmic printjob where jobid=2 delete
Pause a print job
This command too would require you to specify the job id.
wmic printjob where jobid=<jobnumber> pause
Example:
c:\>wmic printjob where jobid=2 pause Executing (\\WINCMD-PC\ROOT\CIMV2:Win32_PrintJob.Name="Myprinter, 2")->Pause() Method execution successful. Out Parameters: instance of __PARAMETERS { ReturnValue = 0; }; c:\>wmic printjob get jobid, document, jobstatus Document JobId JobStatus BankStatement 2 Paused
Resume a paused print job
wmic printjob where jobid=<jobnumber> resume
Oh thanks :)
Is there a way to return the date that the printer completed its last job?
wmic printer get name, portname
has helped me dramatically at my current position.
And for lenovo machines… (unrelated)
wmic bios get serialnumber
How can I export the list jobs logs of a company printer to a SIEM (i.e.: Azure Sentinel) or to a Database (i.e.: SQL)??