Stop spooler before deleting
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user