[BUG] Always show all system tray icons and autounattend.xml
Please confirm these before moving forward
- [x] I have searched for my issue and have not found a similiar in the Open or Closed issues.
- [x] I have tested that this issue has not been fixed in the latest (beta or stable) release.
- [x] I have checked the Discussions section for solutions.
- [x] This issue is about a bug (if it is not, please use the correct template).
Winhance Version
26.04.17
Windows version, edition, and architecture
Windows 11 Pro 24H2/25H2
Describe your issue
Settings Always show all system tray icons in winhance, exporting autounattend.xml, and installing windows does not setup Always show all system tray icons on the new windows install.
The autounattend.xml has the following code in the HKLM section; if I move the code to the HKCU section it works.
# PowerShell script for: Always show all system tray icons
try {
Get-ChildItem 'HKCU:\Control Panel\NotifyIconSettings' | ForEach-Object { Set-ItemProperty $_.PSPath -Name IsPromoted -Value 1 -Type DWord }
Write-Log "Show all system tray icons directly on the taskbar instead of hiding them in the overflow menu. When disabled, all icons will be hidden in the overflow menu. To control individual icon visibility, go to Windows Settings > Personalization > Taskbar > Other system tray icons" "SUCCESS"
} catch {
Write-Log "Failed: Show all system tray icons directly on the taskbar instead of hiding them in the overflow menu. When disabled, all icons will be hidden in the overflow menu. To control individual icon visibility, go to Windows Settings > Personalization > Taskbar > Other system tray icons - $($_.Exception.Message)" "ERROR"
}
Steps to reproduce the issue
- Set Settings Always show all system tray icons in winhance
- export autounattend.xml
- install windows with autounattend.xml
Expected behavior
The default windows icons such as Windows Security should be showing.
Actual behavior
They are not.
Screenshots or Logs (if applicable)
No response
Additional context
No response
Thanks for catching this — your note that moving the block to the HKCU section by hand fixed it was the exact tell we needed.
What was happening: Winhance's autounattend builder sorts registry entries correctly (HKCU keys go into the first-logon pass that runs as the real user; HKLM keys stay in the specialize pass that runs as SYSTEM). But the PowerShell script for 'Always show all system tray icons' was hard-coded into the system pass regardless of what it actually touched. Because that script enumerates HKCU:\Control Panel\NotifyIconSettings, running it as SYSTEM made HKCU: resolve to SYSTEM's own (empty) profile hive — so Get-ChildItem returned nothing and the tweak silently did nothing. Moving it to the HKCU/first-logon section, exactly as you did, makes HKCU: resolve to the interactive user's hive where NotifyIconSettings actually lives.
What changed: PowerShell scripts now carry an explicit RunContext flag, and the tray-icons script (along with a couple of other HKCU-touching scripts that had the same latent issue) is marked as user-context so it lands in the right section automatically. Added catalog-level tests so any future script that references HKCU without being marked user-context will fail CI.
This fix is in the development branch (eaceefc) and will be available for testing in Release 25.