Cleaned variable names

This commit is contained in:
poslop
2026-01-14 12:20:41 -06:00
parent b21f669ffd
commit db0eacbfa0

View File

@@ -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)"
}