Files
management-scripts/Fix-SystemPrintQueue.ps1
T

18 lines
532 B
PowerShell
Raw Normal View History

2021-06-02 16:16:24 -04:00
$SERVICE = 'spooler'
2020-08-18 16:20:20 -04:00
2021-06-02 16:16:24 -04:00
## Make sure the service isn't disabled
If (! ($(Get-Service -Name 'spooler').StartType -eq "Disabled") ) {
2020-08-18 16:20:20 -04:00
2021-06-02 16:16:24 -04:00
## Stop the spooler service
Control-Service -Stop -Name $SERVICE
## Delete all print jobs
2023-10-05 13:11:38 -04:00
Write-Output "Deleting all print jobs from ""${Env:WINDIR}\System32\spool\PRINTERS"""
2021-06-02 16:16:24 -04:00
Try { Remove-Item "${Env:WINDIR}\System32\spool\PRINTERS\*" -Recurse }
Catch { LogErr $_.Exception.Message }
## Start the spooler service
Control-Service -Start -Name $SERVICE
}