-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrinterRepair.ps1
More file actions
37 lines (31 loc) · 1.64 KB
/
Copy pathPrinterRepair.ps1
File metadata and controls
37 lines (31 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#Requires -RunAsAdministrator
#############################################################
# #
# TWOMEY PC REPAIR | Toolbox #
# Independent tech repair - Highland, AR #
# https://github.com/twomeypcrepair #
# #
# No adware. No sponsor offers. #
# No bundled junk. #
# #
# Tool: Printer Repair #
# Stops the Print Spooler, clears the print #
# queue, and restarts the Print Spooler. #
# #
#############################################################
$spoolPath = Join-Path $env:SystemRoot 'System32\spool\PRINTERS'
Write-Host '[1/3] Stopping Print Spooler service...' -ForegroundColor Cyan
Stop-Service -Name Spooler -Force -ErrorAction Stop
Write-Host ''
Write-Host "[2/3] Clearing print queue at $spoolPath..." -ForegroundColor Cyan
if (Test-Path $spoolPath) {
Get-ChildItem -Path $spoolPath -File -Force | Remove-Item -Force -ErrorAction SilentlyContinue
Write-Host ' Queue cleared.' -ForegroundColor Green
} else {
Write-Host ' Spool folder not found - skipping.' -ForegroundColor Yellow
}
Write-Host ''
Write-Host '[3/3] Starting Print Spooler service...' -ForegroundColor Cyan
Start-Service -Name Spooler -ErrorAction Stop
Write-Host ''
Write-Host '[+] Printer repair complete.' -ForegroundColor Green