Stop spooler before deleting
This commit is contained in:
@@ -14,6 +14,8 @@ $HKLMPrinterPaths = @(
|
|||||||
'HKEY_LOCAL_MACHINE\SOFTWARE\Xerox\PrinterDriver'
|
'HKEY_LOCAL_MACHINE\SOFTWARE\Xerox\PrinterDriver'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
net stop spooler
|
||||||
|
|
||||||
foreach ($printerPath in $HKLMPrinterPaths) {
|
foreach ($printerPath in $HKLMPrinterPaths) {
|
||||||
try {
|
try {
|
||||||
Remove-Item -Path "Registry::$printerPath" -Recurse -Force -ErrorAction Stop
|
Remove-Item -Path "Registry::$printerPath" -Recurse -Force -ErrorAction Stop
|
||||||
@@ -42,4 +44,6 @@ foreach ($sidKey in $sids) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
net start spooler
|
||||||
|
|
||||||
gpupdate /force
|
gpupdate /force
|
||||||
|
|||||||
Reference in New Issue
Block a user