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"
}