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