Cleaned variable names
This commit is contained in:
@@ -14,7 +14,7 @@ $profileListKey = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileLis
|
||||
|
||||
$sids = Get-ChildItem $profileListKey
|
||||
|
||||
$printerPaths = @(
|
||||
$HKUsersPrinterPaths = @(
|
||||
'\Printers\Connections',
|
||||
'\Printers\ConvertUserDevModesCount',
|
||||
'\Software\Xerox\PrinterDriver',
|
||||
@@ -42,10 +42,10 @@ foreach ($sidKey in $sids) {
|
||||
$sid = $sidKey.PSChildName
|
||||
$profilePath = (Get-ItemProperty -Path $sidKey.PSPath -Name ProfileImagePath).ProfileImagePath
|
||||
|
||||
foreach ($printerPath in $printerPaths) {
|
||||
foreach ($HKUsersPrinterPath in $HKUsersPrinterPaths) {
|
||||
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
|
||||
Remove-Item -Path "Registry::HKEY_USERS\${sid}${HKUsersPrinterPath}" -Recurse -Force -ErrorAction Stop
|
||||
Write-Host "Removed user profile key HKEY_USERS\${sid}${HKUsersPrinterPath}" --ForegroundColor Green
|
||||
} catch {
|
||||
Write-Host "Error: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user