diff --git a/RemoveHKeyPrinters.ps1 b/RemoveHKeyPrinters.ps1 index 9fcc5e3..609f31d 100644 --- a/RemoveHKeyPrinters.ps1 +++ b/RemoveHKeyPrinters.ps1 @@ -43,12 +43,12 @@ foreach ($sidKey in $sids) { $profilePath = (Get-ItemProperty -Path $sidKey.PSPath -Name ProfileImagePath).ProfileImagePath foreach ($printerPath in $printerPaths) { - try { - Remove-Item -Path "Registry::HKEY_USERS\${sid}${printerPath}" -Recurse -Force -ErrorAction Stop - Write-Host "Removed user profile key HKEY_USERS\${sid}${printerPath}" --ForegroundColor Green - } catch { - Write-Host "Error: $($_.Exception.Message)" - } + try { + Remove-Item -Path "Registry::HKEY_USERS\${sid}${printerPath}" -Recurse -Force -ErrorAction Stop + Write-Host "Removed user profile key HKEY_USERS\${sid}${printerPath}" --ForegroundColor Green + } catch { + Write-Host "Error: $($_.Exception.Message)" + } } }