Stop spooler before deleting

This commit is contained in:
poslop
2026-01-14 10:27:34 -06:00
parent fe7185d593
commit 6153ba5358

View File

@@ -14,6 +14,8 @@ $HKLMPrinterPaths = @(
'HKEY_LOCAL_MACHINE\SOFTWARE\Xerox\PrinterDriver'
)
net stop spooler
foreach ($printerPath in $HKLMPrinterPaths) {
try {
Remove-Item -Path "Registry::$printerPath" -Recurse -Force -ErrorAction Stop
@@ -42,4 +44,6 @@ foreach ($sidKey in $sids) {
}
}
net start spooler
gpupdate /force