winutil
winutil copied to clipboard
Apply tweaks to all users instead of only current user by using a for-each loop
⚙️ Issue Checklist
- [x] I have read the guidelines.
- [x] I checked for duplicate issues.
- [x] I searched for existing discussions.
- [x] I checked for an existing pull request that addresses this request.
❓ Is your feature request related to a problem?
Apply optimizations to all users instead of HKCU: Update the script to do a for-each loop and apply the tweaks to each user that logs on, example:
💡 Describe the solution you'd like
Define the registry path for HKEY_USERS
$registryPath = "HKU:"
Get all subkeys under HKEY_USERS
$subKeys = Get-ChildItem -Path $registryPath
Loop through each subkey
foreach ($subKey in $subKeys) { # Display the subkey name (SID) Write-Host "SubKey (SID): $($subKey.PSChildName)"
# Check if the subkey has a specific value (e.g., Environment variables)
$envKeyPath = "$($subKey.PSPath)\Environment"
if (Test-Path $envKeyPath) {
$envValues = Get-ItemProperty -Path $envKeyPath
Write-Host "Environment Variables:"
$envValues.PSObject.Properties | ForEach-Object {
Write-Host " $($_.Name): $($_.Value)"
}
} else {
Write-Host "No Environment Variables found for this user."
}
Write-Host "-----------------------------------"
}
🔄 Describe alternatives you've considered
No response
🖼️ Additional context
No response