bunch of fixes and updates

This commit is contained in:
2021-06-02 16:16:24 -04:00
parent 9c45e6c8b6
commit 08fb567460
7 changed files with 28 additions and 11 deletions
+15 -8
View File
@@ -1,10 +1,17 @@
## Stop the spooler service
Control-Service -Stop -Name 'spooler'
$SERVICE = 'spooler'
## Delete all print jobs
LogMsg "Deleting all print jobs from ""${Env:WINDIR}\System32\spool\PRINTERS"""
Try { Remove-Item "${Env:WINDIR}\System32\spool\PRINTERS\*" -Recurse }
Catch { LogErr $_.Exception.Message }
## Make sure the service isn't disabled
If (! ($(Get-Service -Name 'spooler').StartType -eq "Disabled") ) {
## Start the spooler service
Control-Service -Start -Name 'spooler'
## Stop the spooler service
Control-Service -Stop -Name $SERVICE
## Delete all print jobs
LogMsg "Deleting all print jobs from ""${Env:WINDIR}\System32\spool\PRINTERS"""
Try { Remove-Item "${Env:WINDIR}\System32\spool\PRINTERS\*" -Recurse }
Catch { LogErr $_.Exception.Message }
## Start the spooler service
Control-Service -Start -Name $SERVICE
}