Restart and clear the Windows print spooler

Restart and clear the Windows print spooler

A very simple PowerShell script to stop, clear and start the print spooler on Windows systems.

Run the below as local admin and it will fetch all stuck files in the printer spooler folder. Stop the spooler, clear it and then start it again.

$printSpooler = Get-ChildItem "C:\Windows\System32\spool\PRINTERS"

try
{
Stop-Service -name "Spooler"

foreach($file in $printSpooler)
{
Write-Host $file.Name
Remove-Item $file.PSPath -Force
}
}

catch
{
Write-Host "Error = "
Write-Host $_
}

finally
{
Start-Service -name "Spooler"
}

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *