WIN-022 · Script
Printer Spooler Reset and Queue Clear
Checks the print spooler for stuck jobs and, in Fix mode, stops it, clears the queue and starts it again.
What it does
Reports the state of the Print Spooler service, every print job that is in an error state or older than -StuckMinutes, and the number of leftover spool files in the spool folder (read from the registry, so a moved spool folder is handled).
Report mode (default) changes nothing and logs what Fix would do. Fix mode stops the spooler, deletes the files in the spool folder (the queued jobs), sets the service back to Automatic if it was disabled, starts it again and confirms it is running. By default Fix only acts when a problem is found; use -ForceReset to reset even when everything looks fine.
Printers, drivers and ports are never removed. Any job still in the queue is deleted in Fix mode, including jobs that were not stuck, so users may need to print again. Runs silently as SYSTEM from any RMM or Intune. No prompts, no user interaction.
Requirements
Windows PowerShell 5.1+, run as SYSTEM or local admin
How to run it
- Run as: SYSTEM or a local administrator
- Run from: any RMM or MDM, Intune, a Group Policy startup script, a scheduled task, or an elevated PowerShell window
- Script type: PowerShell, 64-bit
- User interaction: none; the script never prompts
- Timeout: 10 minutes (30 for Windows Update installs)
Settings
| Name | What it does | Options | Default |
|---|---|---|---|
| Mode | Report (default) = read-only. Fix = stop the spooler, clear the queue and start it again. | Report, Fix | Report |
| StuckMinutes | A job older than this many minutes counts as stuck. Default 30. Example: 60. | 30 | |
| ForceReset | In Fix mode, reset the spooler even when no problem is found. | False |
Exit codes
- 0 = Spooler healthy, or reset done and spooler running
- 1 = Problem found (Report), or spooler not running after Fix
- 2 = Script error
Testing steps
- Run it first with the mode set to Report on one test device. Nothing is changed in that mode.
- Read the log and confirm the planned changes are what you expect.
- Run your chosen settings on the same test target and confirm the result.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- Roll out to a small group next, then everyone.
Rollback steps
Nothing to restore for printers, drivers or ports, which are never touched. Jobs deleted from the queue cannot be recovered; users print again. If Fix changed a disabled spooler to Automatic, set it back with: Set-Service -Name Spooler -StartupType Disabled; Stop-Service Spooler.
Version and change log
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |