Windows: How to empty an large printer queue

von sparrow242

A Windows 2008 Server had strange problems with the printing-system (spooler).

The problem was a dummy printer, which was wrong configured. The queue holded up near 100.000 jobs.
Quest: empty the queue without breaking the printing-system (there are much more printers installed there, which are needed online).

What not works:

  • Open the graphical queue and delete the jobs in the GUI. (Delete all jobs)
    No good idea. The explorer- and spooler-process eat the whole resources. Spooler is not responding and the other printers are dead.
  • Same as above but not the whole queue at once.
    Oh, it works with~200 jobs / delete. 100.000 / 200 = 500 parts. I’m to old for that.
  • Stopping spooler and delete the jobs from \windows\system32\spool
    Stopping spooler? I need the other printers online and working!


I modfied the script from here to delete all printjobs for a specified printer. For other selections please take a look at the class.

strComputer = "." 
Set objWMIService = GetObject("winmgmts:" _ 
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") 
Set colPrintJobs =  objWMIService.ExecQuery _ 
    ("Select * from Win32_PrintJob Where Name Like 'PRINTER_NAME%'") 

i = 0 

For Each objPrintJob in colPrintJobs  
    i = i + 1
    wscript.echo i & " Done!"

Save the script to a texfile with .vbs as extension and replace PRINTER_NAME with the the name of the printer, which queue you will empty (the ‚%‘ must follow the name!). With max. 20 jobs per second to delete, the spooler was still up for other printers.
Run the script with cscipt your_scriptname.vbs

Yeah, it took a while. But it worked and the other printers were up all the time.

— der Würschtlmann