How to Clear the Print Spooler Queue in Windows Server using PowerShell

The Nightmare of a Stuck Print Queue

In any office environment, printers are a notorious source of IT headaches. One of the most common issues occurs when a corrupted document gets sent to a Windows Server acting as a print server. The corrupted file gets stuck in the print queue, freezing the entire spooler service. Users keep mashing the “Print” button, causing dozens of healthy documents to pile up behind the corrupted one, eventually bringing the entire print server to a crawl.

When you try to right-click and “Cancel” the document in the GUI, it simply says “Deleting…” forever. The only way to fix this is to forcefully stop the Print Spooler service, manually delete the raw spool files from the system drive, and restart the service. Doing this via PowerShell is significantly faster than using the GUI.

The PowerShell Solution

To clear the stuck queue, you must execute these commands in an elevated PowerShell window (Run as Administrator) directly on the print server.

Step 1: Stop the Print Spooler Service

Before you can delete the corrupted files, you must stop the service that is holding them open and locking them. Run the following cmdlet:

Stop-Service -Name Spooler -Force

The -Force flag ensures that the service stops immediately, even if it is currently attempting to process a document.

Step 2: Delete the Raw Spool Files

When a document is sent to the printer, Windows converts it into two files: a .SPL file (the actual print data) and a .SHD file (the shadow file containing the routing metadata). These files are stored deep within the System32 directory.

Run the following command to forcefully delete all spool files, effectively wiping the queue completely clean:

Remove-Item -Path "$env:windir\System32\spool\PRINTERS\*.*" -Force -Recurse

Note: This will delete ALL pending print jobs on the server. Warn your users that they will need to resubmit their documents after the service is restored.

Step 3: Restart the Print Spooler

With the corrupted files gone, it is safe to turn the printing subsystem back on.

Start-Service -Name Spooler

Automating the Process with a Script

If your office suffers from stuck queues frequently, you can combine these commands into a single, reusable script. Save the following lines as Clear-PrintQueue.ps1 on your desktop:

Write-Host "Stopping Print Spooler..."
Stop-Service -Name Spooler -Force
Write-Host "Clearing corrupted spool files..."
Remove-Item -Path "$env:windir\System32\spool\PRINTERS\*.*" -Force -Recurse
Write-Host "Restarting Print Spooler..."
Start-Service -Name Spooler
Write-Host "Print Queue Successfully Cleared!"

The next time the printer freezes, simply right-click the script and select “Run with PowerShell” to instantly resolve the issue.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.