From 79fcfea8df4bfc8314465efc1c4dbdb7b1b97883 Mon Sep 17 00:00:00 2001 From: X9 Date: Sun, 15 Mar 2026 21:17:02 +0100 Subject: [PATCH] Fix search box and systray for Win10/Win11 compatibility - Add Search subkey for Win10 search box hiding - Clear TrayNotify icon streams as Win11 systray workaround - Restart Explorer to apply taskbar changes in current session Co-Authored-By: Claude Sonnet 4.6 --- scripts/04-default-profile.ps1 | 37 +++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/scripts/04-default-profile.ps1 b/scripts/04-default-profile.ps1 index 332a6fe..03b0b1e 100644 --- a/scripts/04-default-profile.ps1 +++ b/scripts/04-default-profile.ps1 @@ -131,7 +131,10 @@ try { # Win11: align taskbar to left (0 = left, 1 = center) Set-ProfileReg -SubKey $tbPath -Name "TaskbarAl" -Value 0 - # Hide Search box / button (0 = hidden, 1 = icon, 2 = full box) + # Hide Search box / button - Win10/11 (0 = hidden, 1 = icon, 2 = full box) + # Note: Win11 uses Search subkey, Win10 uses Explorer\Advanced - set both + Set-ProfileReg -SubKey "Software\Microsoft\Windows\CurrentVersion\Search" ` + -Name "SearchboxTaskbarMode" -Value 0 Set-ProfileReg -SubKey $tbPath -Name "SearchboxTaskbarMode" -Value 0 # Hide Task View button @@ -155,9 +158,27 @@ try { # ----------------------------------------------------------------------- # System tray - show all icons # ----------------------------------------------------------------------- + # EnableAutoTray = 0 works on Win10; Win11 ignores it but set anyway Set-ProfileReg -SubKey "Software\Microsoft\Windows\CurrentVersion\Explorer" ` -Name "EnableAutoTray" -Value 0 + # Win11 workaround: clear cached tray icon streams so all icons appear on next login + # Windows rebuilds the streams with all icons visible when no cache exists + $trayNotifyKey = "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" + if (Test-Path $trayNotifyKey) { + Remove-ItemProperty -Path $trayNotifyKey -Name "IconStreams" -Force -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $trayNotifyKey -Name "PastIconsStream" -Force -ErrorAction SilentlyContinue + Write-Log " Cleared TrayNotify icon streams (Win11 systray workaround)" -Level OK + } + + # Also clear in Default hive so new users start with clean state + $defTrayKey = "Registry::HKU\DefaultProfile\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" + if (Test-Path $defTrayKey) { + Remove-ItemProperty -Path $defTrayKey -Name "IconStreams" -Force -ErrorAction SilentlyContinue + Remove-ItemProperty -Path $defTrayKey -Name "PastIconsStream" -Force -ErrorAction SilentlyContinue + Write-Log " Cleared TrayNotify icon streams in Default hive" -Level OK + } + # ----------------------------------------------------------------------- # Desktop icons - show This PC # ----------------------------------------------------------------------- @@ -286,4 +307,18 @@ finally { } } +# ----------------------------------------------------------------------- +# Restart Explorer to apply taskbar/tray changes to current session +# ----------------------------------------------------------------------- +Write-Log "Restarting Explorer to apply taskbar changes" -Level INFO +try { + Stop-Process -Name explorer -Force -ErrorAction SilentlyContinue + Start-Sleep -Seconds 2 + Start-Process explorer + Write-Log "Explorer restarted" -Level OK +} +catch { + Write-Log "Explorer restart failed (non-fatal): $_" -Level WARN +} + Write-Log "Step 4 complete" -Level OK