EnableAutoTray=0 works only on Windows 11 21H2 and early Windows 10 builds. Microsoft changed the logic in 22H2: tray icon preferences are now managed via Settings UI and deeply encoded in per-user settings under the hood. There’s no documented or reliable registry, PowerShell, or unattended method to force this for all apps/icons in recent builds.HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ExplorerEnableAutoTrayWindows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"EnableAutoTray"=dword:00000000ShowAllTrayIcons.reg.reg import ShowAllTrayIcons.regtaskkill /f /im explorer.exe and then start explorer.exereg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f
taskkill /f /im explorer.exe
start explorer.exeSet-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name EnableAutoTray -Value 0
Stop-Process -Name explorer -Force
Start-Process explorer<FirstLogonCommands> entry in your answer file so it applies at first logon for every user.the script does not work do you have another because it is in autounattend.xmlTo always show all tray icons in Windows 11—so that all notification area icons are visible in the taskbar (i.e., none hidden in the overflow/“hidden icons” area)—you need to adjust a user setting which is controlled by the registry.
For Windows 11 (and Windows 10):
Registry Tweak:
This setting is per-user and the easiest way is via this registry path:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
Key:EnableAutoTray
- 0: Always show all icons (no hidden overflow)
- 1: Hide unused icons (show only important, rest in overflow)
.reg File Example:
Apply this tweak:Code:Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "EnableAutoTray"=dword:00000000
- Save the text above as
ShowAllTrayIcons.reg.- Double-click to import, or run:
reg import ShowAllTrayIcons.reg- Restart explorer.exeto apply:
- Run
taskkill /f /im explorer.exeand thenstart explorer.exe- Or simply log off/on.
Automated Script (Batch or PowerShell):
Batch:
Code:reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f taskkill /f /im explorer.exe start explorer.exePowerShell:
Code:Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name EnableAutoTray -Value 0 Stop-Process -Name explorer -Force Start-Process explorerTo deploy in unattended install
Add the batch or PowerShell as a<FirstLogonCommands>entry in your answer file so it applies at first logon for every user.
Note:
- This tweak works for Windows 10/11 for classic Win32 apps. Some modern (UWP) apps may ignore it, but for almost all notification area icons, this will work.
- The user can always change it back via Settings > Personalization > Taskbar > "Other system tray icons", but this approach forces all eligible icons to be visible by default.
Let me know if you want a sample unattend.xml snippet or want to combine this with other desktop/taskbar tweaks!
EnableAutoTray registry tweak is now ignored, and tray icon visibility is controlled by new settings in the "Other System Tray icons" area under Settings, which stores state in binary-encoded registry values named like NotifyIconSettings.EnableAutoTray hack won't work for versions after 21H2. Microsoft now expects users to control tray icons from:Settings > Personalization > Taskbar > Other system tray iconsEnableAutoTray=0 may work, but not on 22H2+.| Windows Version | "EnableAutoTray" Works? | Can force all via script? | 
|---|---|---|
| Win 10 / Win 11 21H2 | Yes | Yes | 
| Win 11 22H2+ | No | No (UI only) | 
i am looking for script for Always show all tray icons for all version of windows 11 because i use it in an autounattend.xmlThank you for clarifying. Starting with Windows 11 22H2 and newer, Microsoft changed the way tray (system tray) icons are managed. TheEnableAutoTrayregistry tweak is now ignored, and tray icon visibility is controlled by new settings in the "Other System Tray icons" area under Settings, which stores state in binary-encoded registry values named likeNotifyIconSettings.
There is currently no documented or reliable registry/script-only method to force "Always show all tray icons" for all apps in the system tray on modern Windows 11 releases (22H2, 23H2+). The oldEnableAutoTrayhack won't work for versions after 21H2. Microsoft now expects users to control tray icons from:
Settings > Personalization > Taskbar > Other system tray icons
Your Automation Options for Modern Windows 11
1. For SYSTEM Icons Only (Network, Volume, etc.)
You can still automate those via registry/policy (e.g., Group Policy). But third-party and new Windows icons are not controllable globally—each user/app manages visibility.
2. For All/Other Tray Icons (Post-22H2):
- There's no supported registry key or GPO.
- No known or documented PowerShell or batch hack for all users/tray icons.
- You can instruct users to manually enable:
Open Settings → Personalization → Taskbar → Other system tray icons → Set to "On" for each app.Reference (Microsoft Docs/Tech Community):
- This limitation is widely confirmed on Windows IT/admin forums.
- Microsoft's intent appears to be (for security/user preference reasons), only user interaction can control the full tray icon set in UI.
What You Can Still Script
- Using legacy methods you may show/hide some system notifications/icons but not force "always show all" for all app icons.
- For classic/Win32 icons (on older builds/21H2):
EnableAutoTray=0may work, but not on 22H2+.Summary Table
Windows Version "EnableAutoTray" Works? Can force all via script? Win 10 / Win 11 21H2 Yes Yes Win 11 22H2+ No No (UI only) What Should You Do?
- For 22H2+: You (and every other IT admin) must instruct users to enable all icons in the UI; there is no global script or answer file method.
- You may leave guidance for users, or if possible, roll back to 21H2 or use a third-party tray icon manager.
- If you want a script that works for 21H2 and older, use the previously posted solutions; but for newer builds, this is now a locked-down setting.
If you have a specific build/version/environment or need help with a hybrid approach (legacy + user guidance), let me know! If Microsoft changes this in a future Windows 11 version or documents a new policy, I'll update you with a working solution.
EnableAutoTray=0 works only on Windows 11 21H2 and early Windows 10 builds. Microsoft changed the logic in 22H2: tray icon preferences are now managed via Settings UI and deeply encoded in per-user settings under the hood. There’s no documented or reliable registry, PowerShell, or unattended method to force this for all apps/icons in recent builds.Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]
"EnableAutoTray"=dword:00000000reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f
taskkill /f /im explorer.exe
start explorer.exe<FirstLogonCommands> for max compatibility.NotifyIconSettings), but these are version- and profile-specific, and NOT supported (high risk, break with updates).<FirstLogonCommands>
  <SynchronousCommand wcm:action="add">
    <Order>1</Order>
    <Description>Enable All Tray Icons (if supported)</Description>
    <CommandLine>reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f</CommandLine>
  </SynchronousCommand>
  <SynchronousCommand wcm:action="add">
    <Order>2</Order>
    <Description>Restart Explorer</Description>
    <CommandLine>cmd /c taskkill /f /im explorer.exe & start explorer.exe</CommandLine>
  </SynchronousCommand>
  <!-- Optional: Show instructions -->
  <SynchronousCommand wcm:action="add">
    <Order>3</Order>
    <Description>Show Tray Icon Instructions</Description>
    <CommandLine>notepad.exe C:\SetupFiles\SHOW_ALL_TRAY_ICONS_README.txt</CommandLine>
  </SynchronousCommand>
</FirstLogonCommands>.txt file with friendly user instructions for the latest Windows 11 UI.i am looking for script for Always show all tray icons for all version of windows 11 because i use it in an autounattend.xml
Unfortunately, there is currently NO universally effective script, registry key, or answer file directive that will “always show all tray icons” across ALL versions of Windows 11 via automation—especially for 22H2 and later.
Summary and Details:
EnableAutoTray=0works only on Windows 11 21H2 and early Windows 10 builds. Microsoft changed the logic in 22H2: tray icon preferences are now managed via Settings UI and deeply encoded in per-user settings under the hood. There’s no documented or reliable registry, PowerShell, or unattended method to force this for all apps/icons in recent builds.- For 22H2 and newer, only some SYSTEM icons (like Network, Volume, etc.) can still be controlled in the registry/Group Policy. User/3rd-party app icons now require per-user Settings interaction (Settings > Personalization > Taskbar > “Other system tray icons”).
- Windows Setup (unattend.xml), GPO, or any background script cannot bypass or override controls for all icons on 22H2+.
What You CAN Do in Autounattend for Best Coverage:
- Apply the legacy registry for Win10/Win11 21H2 (works for old builds, won’t hurt new ones):
Or as a script:Code:Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "EnableAutoTray"=dword:00000000
Put this inCode:reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f taskkill /f /im explorer.exe start explorer.exe<FirstLogonCommands>for max compatibility.- For new builds (22H2+), include user instructions:
- Prompt users to visit Settings > Personalization > Taskbar > Other system tray icons and toggle everything ON.
- Optionally, in your deployment/image, create a desktop file or launch Notepad/Edge with step-by-step instructions for the end user.
- If you truly NEED full automation for all editions/future versions—no native solution exists as of mid-2024. There are no supported, sanctioned, or reliable workarounds for 22H2+.
If You Attempt Forced Methods (ADVANCED & UNSUPPORTED):
- You may find third-party tray managers (which themselves act as replacement shells).
- Some tools hack undocumented registry blobs (
NotifyIconSettings), but these are version- and profile-specific, and NOT supported (high risk, break with updates).Practical Autounattend Snippet (For Max Range):
Create or edit theCode:<FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Enable All Tray Icons (if supported)</Description> <CommandLine>reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <Description>Restart Explorer</Description> <CommandLine>cmd /c taskkill /f /im explorer.exe & start explorer.exe</CommandLine> </SynchronousCommand> <!-- Optional: Show instructions --> <SynchronousCommand wcm:action="add"> <Order>3</Order> <Description>Show Tray Icon Instructions</Description> <CommandLine>notepad.exe C:\SetupFiles\SHOW_ALL_TRAY_ICONS_README.txt</CommandLine> </SynchronousCommand> </FirstLogonCommands>.txtfile with friendly user instructions for the latest Windows 11 UI.
If Microsoft changes this in the future, or a new method is discovered, I’ll be happy to update you.
For now, manual user action is required after 22H2 for full tray icon visibility—no script can universally force it. Let me know if you’d like help preparing a user guide or optimizing unattended deployment for what’s possible!
# ShowAllTrayIcons.ps1
# Attempts to show all system tray icons in Windows 11 22H2+
# Run with Administrator privileges for best results
param(
    [switch]$Monitor,
    [switch]$InstallTask,
    [switch]$Verbose
)
# Function to log messages
function Write-Log {
    param($Message, $Type = "Info")
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $color = switch($Type) {
        "Error" { "Red" }
        "Warning" { "Yellow" }
        "Success" { "Green" }
        default { "White" }
    }
    Write-Host "[$timestamp] $Message" -ForegroundColor $color
}
# Function to decode binary tray icon data
function Decode-TrayIconStream {
    param([byte[]]$Data)
    
    try {
        # The binary format contains icon paths and settings
        # This is a simplified decoder - actual format is undocumented
        $text = [System.Text.Encoding]::Unicode.GetString($Data)
        $paths = [regex]::Matches($text, '[A-Z]:\\[^\\]+(?:\\[^\\]+)*\.exe', [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
        return $paths | ForEach-Object { $_.Value } | Select-Object -Unique
    }
    catch {
        return @()
    }
}
# Function to enable tray icon visibility
function Enable-TrayIcon {
    param($RegistryPath)
    
    try {
        # Method 1: Set IsPromoted flag
        Set-ItemProperty -Path $RegistryPath -Name "IsPromoted" -Value 1 -Type DWord -ErrorAction SilentlyContinue
        
        # Method 2: Modify IconStreams if it exists
        if (Test-Path "$RegistryPath\IconStreams") {
            $iconStream = Get-ItemProperty -Path "$RegistryPath\IconStreams" -ErrorAction SilentlyContinue
            if ($iconStream.PSObject.Properties.Name -contains "0") {
                # Attempt to modify visibility flag in binary data
                $data = $iconStream."0"
                if ($data -is [byte[]]) {
                    # Look for visibility flags (usually at specific offsets)
                    # This is experimental as format is undocumented
                    for ($i = 0; $i -lt $data.Length - 4; $i++) {
                        if ($data[$i] -eq 0x00 -and $data[$i+1] -eq 0x00 -and 
                            $data[$i+2] -eq 0x00 -and $data[$i+3] -eq 0x00) {
                            $data[$i] = 0x01
                            break
                        }
                    }
                    Set-ItemProperty -Path "$RegistryPath\IconStreams" -Name "0" -Value $data -Type Binary
                }
            }
        }
        
        return $true
    }
    catch {
        Write-Log "Error enabling tray icon at $RegistryPath`: $_" -Type Error
        return $false
    }
}
# Function to find and enable all tray icons
function Enable-AllTrayIcons {
    Write-Log "Starting tray icon visibility update..."
    
    $enabledCount = 0
    $paths = @(
        "HKCU:\Control Panel\NotifyIconSettings",
        "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify"
    )
    
    foreach ($basePath in $paths) {
        if (Test-Path $basePath) {
            $subKeys = Get-ChildItem -Path $basePath -ErrorAction SilentlyContinue
            
            foreach ($key in $subKeys) {
                if ($Verbose) {
                    Write-Log "Processing: $($key.PSChildName)"
                }
                
                if (Enable-TrayIcon -RegistryPath $key.PSPath) {
                    $enabledCount++
                }
            }
        }
    }
    
    # Additional method: Force tray refresh
    try {
        # Try to set the legacy EnableAutoTray (still works for some icons)
        Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" `
                        -Name "EnableAutoTray" -Value 0 -Type DWord -ErrorAction SilentlyContinue
        
        # Notify icon settings
        $notifyPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
        Set-ItemProperty -Path $notifyPath -Name "TaskbarSd" -Value 1 -Type DWord -ErrorAction SilentlyContinue
        Set-ItemProperty -Path $notifyPath -Name "TaskbarDa" -Value 1 -Type DWord -ErrorAction SilentlyContinue
    }
    catch {}
    
    Write-Log "Enabled $enabledCount tray icon entries" -Type Success
    return $enabledCount
}
# Function to restart Explorer to apply changes
function Restart-Explorer {
    Write-Log "Restarting Explorer to apply changes..."
    
    try {
        $explorer = Get-Process explorer -ErrorAction SilentlyContinue
        if ($explorer) {
            $explorer | Stop-Process -Force
            Start-Sleep -Seconds 2
            Start-Process explorer
            Write-Log "Explorer restarted successfully" -Type Success
        }
    }
    catch {
        Write-Log "Error restarting Explorer: $_" -Type Error
    }
}
# Function to monitor for new tray icons
function Start-TrayIconMonitor {
    Write-Log "Starting tray icon monitor service..."
    
    $lastCheck = @{}
    
    while ($true) {
        try {
            $currentIcons = @{}
            
            # Check for new icons
            $paths = @(
                "HKCU:\Control Panel\NotifyIconSettings",
                "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify"
            )
            
            foreach ($basePath in $paths) {
                if (Test-Path $basePath) {
                    Get-ChildItem -Path $basePath -ErrorAction SilentlyContinue | ForEach-Object {
                        $currentIcons[$_.PSChildName] = $true
                        
                        if (-not $lastCheck.ContainsKey($_.PSChildName)) {
                            Write-Log "New tray icon detected: $($_.PSChildName)"
                            Enable-TrayIcon -RegistryPath $_.PSPath
                        }
                    }
                }
            }
            
            $lastCheck = $currentIcons
        }
        catch {
            Write-Log "Monitor error: $_" -Type Error
        }
        
        Start-Sleep -Seconds 30
    }
}
# Function to create scheduled task for persistence
function Install-ScheduledTask {
    Write-Log "Installing scheduled task for automatic tray icon management..."
    
    $scriptPath = $MyInvocation.MyCommand.Path
    if (-not $scriptPath) {
        Write-Log "Script must be saved to file before installing scheduled task" -Type Error
        return
    }
    
    $taskName = "ShowAllTrayIcons"
    $action = New-ScheduledTaskAction -Execute "powershell.exe" `
                                      -Argument "-ExecutionPolicy Bypass -WindowStyle Hidden -File `"$scriptPath`" -Monitor"
    
    $trigger = New-ScheduledTaskTrigger -AtLogon
    $principal = New-ScheduledTaskPrincipal -UserId $env:USERNAME -LogonType Interactive -RunLevel Highest
    $settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
                                            -StartWhenAvailable -ExecutionTimeLimit 0
    
    try {
        Register-ScheduledTask -TaskName $taskName -Action $action -Trigger $trigger `
                              -Principal $principal -Settings $settings -Force
        Write-Log "Scheduled task installed successfully" -Type Success
    }
    catch {
        Write-Log "Error installing scheduled task: $_" -Type Error
    }
}
# Function to hook into shell notifications (experimental)
function Enable-ShellHook {
    try {
        Add-Type @"
            using System;
            using System.Runtime.InteropServices;
            
            public class ShellHook {
                [DllImport("user32.dll")]
                public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
                
                [DllImport("user32.dll")]
                public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, 
                                                        string lpszClass, string lpszWindow);
                
                [DllImport("user32.dll")]
                public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
                
                public static void ShowAllTrayIcons() {
                    IntPtr taskbar = FindWindow("Shell_TrayWnd", null);
                    IntPtr trayNotify = FindWindowEx(taskbar, IntPtr.Zero, "TrayNotifyWnd", null);
                    IntPtr sysPager = FindWindowEx(trayNotify, IntPtr.Zero, "SysPager", null);
                    IntPtr toolbarWindow = FindWindowEx(sysPager, IntPtr.Zero, "ToolbarWindow32", null);
                    
                    if (toolbarWindow != IntPtr.Zero) {
                        ShowWindow(toolbarWindow, 5); // SW_SHOW
                    }
                }
            }
"@ -ErrorAction SilentlyContinue
        
        [ShellHook]::ShowAllTrayIcons()
    }
    catch {}
}
# Main execution
Write-Log "=== Show All Tray Icons Script for Windows 11 ==="
# Check if running as administrator
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $isAdmin) {
    Write-Log "Running without administrator privileges - some features may not work" -Type Warning
}
if ($InstallTask) {
    Install-ScheduledTask
    return
}
if ($Monitor) {
    Start-TrayIconMonitor
    return
}
# Normal execution - enable all icons and restart Explorer
$count = Enable-AllTrayIcons
Enable-ShellHook
if ($count -gt 0) {
    Write-Log "Changes applied to $count tray icons"
    
    $response = Read-Host "Restart Explorer to apply changes? (Y/N)"
    if ($response -eq 'Y') {
        Restart-Explorer
    }
} else {
    Write-Log "No tray icons found or all already visible" -Type Warning
}
Write-Log "Script completed!"# UndoShowAllTrayIcons.ps1
# Reverts all changes made by ShowAllTrayIcons.ps1
# Run with Administrator privileges for best results
param(
    [switch]$RestoreDefaults,
    [switch]$HideAll,
    [switch]$Verbose
)
# Function to log messages
function Write-Log {
    param($Message, $Type = "Info")
    $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
    $color = switch($Type) {
        "Error" { "Red" }
        "Warning" { "Yellow" }
        "Success" { "Green" }
        default { "White" }
    }
    Write-Host "[$timestamp] $Message" -ForegroundColor $color
}
# Function to remove scheduled task
function Remove-TrayIconTask {
    Write-Log "Removing scheduled task..."
    
    $taskName = "ShowAllTrayIcons"
    
    try {
        $task = Get-ScheduledTask -TaskName $taskName -ErrorAction SilentlyContinue
        if ($task) {
            Unregister-ScheduledTask -TaskName $taskName -Confirm:$false
            Write-Log "Scheduled task removed successfully" -Type Success
        } else {
            Write-Log "Scheduled task not found" -Type Warning
        }
    }
    catch {
        Write-Log "Error removing scheduled task: $_" -Type Error
    }
}
# Function to restore default tray icon settings
function Restore-TrayIconDefaults {
    param($RegistryPath)
    
    try {
        # Remove the IsPromoted flag (this hides the icon again)
        Remove-ItemProperty -Path $RegistryPath -Name "IsPromoted" -ErrorAction SilentlyContinue
        
        # Reset IconStreams to default if modified
        if (Test-Path "$RegistryPath\IconStreams") {
            # Instead of modifying, we can remove and let Windows recreate
            Remove-Item -Path "$RegistryPath\IconStreams" -Recurse -Force -ErrorAction SilentlyContinue
        }
        
        return $true
    }
    catch {
        if ($Verbose) {
            Write-Log "Error processing $RegistryPath`: $_" -Type Error
        }
        return $false
    }
}
# Function to hide tray icon (opposite of show)
function Hide-TrayIcon {
    param($RegistryPath)
    
    try {
        # Set IsPromoted to 0 to hide
        Set-ItemProperty -Path $RegistryPath -Name "IsPromoted" -Value 0 -Type DWord -ErrorAction SilentlyContinue
        return $true
    }
    catch {
        return $false
    }
}
# Function to restore all tray icons to default
function Restore-AllTrayIcons {
    Write-Log "Restoring tray icon settings..."
    
    $processedCount = 0
    $paths = @(
        "HKCU:\Control Panel\NotifyIconSettings",
        "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify"
    )
    
    foreach ($basePath in $paths) {
        if (Test-Path $basePath) {
            $subKeys = Get-ChildItem -Path $basePath -ErrorAction SilentlyContinue
            
            foreach ($key in $subKeys) {
                if ($Verbose) {
                    Write-Log "Processing: $($key.PSChildName)"
                }
                
                if ($HideAll) {
                    if (Hide-TrayIcon -RegistryPath $key.PSPath) {
                        $processedCount++
                    }
                } else {
                    if (Restore-TrayIconDefaults -RegistryPath $key.PSPath) {
                        $processedCount++
                    }
                }
            }
        }
    }
    
    # Restore the legacy EnableAutoTray to default (1 = hide inactive icons)
    try {
        Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" `
                        -Name "EnableAutoTray" -Value 1 -Type DWord -ErrorAction SilentlyContinue
        
        # Remove any custom notification settings
        $notifyPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
        Remove-ItemProperty -Path $notifyPath -Name "TaskbarSd" -ErrorAction SilentlyContinue
        Remove-ItemProperty -Path $notifyPath -Name "TaskbarDa" -ErrorAction SilentlyContinue
    }
    catch {}
    
    Write-Log "Processed $processedCount tray icon entries" -Type Success
    return $processedCount
}
# Function to reset tray notification area completely
function Reset-TrayNotificationArea {
    Write-Log "Performing complete tray notification area reset..."
    
    try {
        # Stop Explorer
        $explorer = Get-Process explorer -ErrorAction SilentlyContinue
        if ($explorer) {
            $explorer | Stop-Process -Force
            Start-Sleep -Seconds 2
        }
        
        # Delete IconStreams and PastIconsStream to force Windows to rebuild
        $trayNotifyPath = "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify"
        
        if (Test-Path $trayNotifyPath) {
            Remove-ItemProperty -Path $trayNotifyPath -Name "IconStreams" -ErrorAction SilentlyContinue
            Remove-ItemProperty -Path $trayNotifyPath -Name "PastIconsStream" -ErrorAction SilentlyContinue
            Write-Log "Tray notification cache cleared" -Type Success
        }
        
        # Restart Explorer
        Start-Process explorer
        Write-Log "Explorer restarted - tray area will rebuild" -Type Success
        
        return $true
    }
    catch {
        Write-Log "Error during reset: $_" -Type Error
        return $false
    }
}
# Function to create a system restore point
function Create-RestorePoint {
    if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
        Write-Log "Cannot create restore point without administrator privileges" -Type Warning
        return
    }
    
    try {
        Write-Log "Creating system restore point..."
        Checkpoint-Computer -Description "Before undoing tray icon changes" -RestorePointType "MODIFY_SETTINGS" -ErrorAction Stop
        Write-Log "System restore point created" -Type Success
    }
    catch {
        Write-Log "Could not create restore point: $_" -Type Warning
    }
}
# Function to export current settings for backup
function Export-CurrentSettings {
    $backupPath = "$env:USERPROFILE\Desktop\TrayIconBackup_$(Get-Date -Format 'yyyyMMdd_HHmmss').reg"
    
    try {
        Write-Log "Backing up current settings to $backupPath..."
        
        $regCommands = @(
            "reg export `"HKCU\Control Panel\NotifyIconSettings`" `"$backupPath`" /y",
            "reg export `"HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify`" `"$backupPath.2`" /y"
        )
        
        foreach ($cmd in $regCommands) {
            Invoke-Expression $cmd | Out-Null
        }
        
        Write-Log "Backup completed" -Type Success
    }
    catch {
        Write-Log "Backup failed: $_" -Type Error
    }
}
# Main execution
Write-Log "=== Undo Show All Tray Icons Script for Windows 11 ==="
# Check if running as administrator
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $isAdmin) {
    Write-Log "Running without administrator privileges - some features may not work" -Type Warning
}
# Ask user what they want to do
if (-not $RestoreDefaults -and -not $HideAll) {
    Write-Host "`nWhat would you like to do?"
    Write-Host "1. Restore Windows default behavior (recommended)"
    Write-Host "2. Hide all tray icons"
    Write-Host "3. Complete reset (clears all tray settings)"
    Write-Host "4. Just remove scheduled task"
    Write-Host "5. Exit"
    
    $choice = Read-Host "`nEnter your choice (1-5)"
    
    switch ($choice) {
        "1" { $RestoreDefaults = $true }
        "2" { $HideAll = $true }
        "3" { 
            $confirm = Read-Host "`nThis will clear ALL tray icon settings. Continue? (Y/N)"
            if ($confirm -eq 'Y') {
                Export-CurrentSettings
                Reset-TrayNotificationArea
                Remove-TrayIconTask
                Write-Log "Complete reset finished!" -Type Success
                exit
            }
        }
        "4" { 
            Remove-TrayIconTask
            Write-Log "Task removal completed!" -Type Success
            exit
        }
        "5" { exit }
        default { 
            Write-Log "Invalid choice" -Type Error
            exit
        }
    }
}
# Create backup
Export-CurrentSettings
# Remove scheduled task
Remove-TrayIconTask
# Process tray icons
$count = Restore-AllTrayIcons
if ($count -gt 0) {
    Write-Log "Changes applied to $count tray icon entries"
    
    $response = Read-Host "`nRestart Explorer to apply changes? (Y/N)"
    if ($response -eq 'Y') {
        Write-Log "Restarting Explorer..."
        Get-Process explorer | Stop-Process -Force
        Start-Sleep -Seconds 2
        Start-Process explorer
        Write-Log "Explorer restarted successfully" -Type Success
    }
} else {
    Write-Log "No changes were necessary" -Type Warning
}
Write-Log "Undo script completed!"
Write-Log "Your settings backup is saved on the Desktop" -Type SuccessEnableAutoTray work only for system icons or older builds, not for recent user/app icons.gpedit.msc → “Turn system icons on or off”).Unfortunately, there is currently NO universally effective script, registry key, or answer file directive that will “always show all tray icons” across ALL versions of Windows 11 via automation—especially for 22H2 and later.
Summary and Details:
EnableAutoTray=0works only on Windows 11 21H2 and early Windows 10 builds. Microsoft changed the logic in 22H2: tray icon preferences are now managed via Settings UI and deeply encoded in per-user settings under the hood. There’s no documented or reliable registry, PowerShell, or unattended method to force this for all apps/icons in recent builds.- For 22H2 and newer, only some SYSTEM icons (like Network, Volume, etc.) can still be controlled in the registry/Group Policy. User/3rd-party app icons now require per-user Settings interaction (Settings > Personalization > Taskbar > “Other system tray icons”).
- Windows Setup (unattend.xml), GPO, or any background script cannot bypass or override controls for all icons on 22H2+.
What You CAN Do in Autounattend for Best Coverage:
- Apply the legacy registry for Win10/Win11 21H2 (works for old builds, won’t hurt new ones):
Or as a script:Code:Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "EnableAutoTray"=dword:00000000
Put this inCode:reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f taskkill /f /im explorer.exe start explorer.exe<FirstLogonCommands>for max compatibility.- For new builds (22H2+), include user instructions:
- Prompt users to visit Settings > Personalization > Taskbar > Other system tray icons and toggle everything ON.
- Optionally, in your deployment/image, create a desktop file or launch Notepad/Edge with step-by-step instructions for the end user.
- If you truly NEED full automation for all editions/future versions—no native solution exists as of mid-2024. There are no supported, sanctioned, or reliable workarounds for 22H2+.
If You Attempt Forced Methods (ADVANCED & UNSUPPORTED):
- You may find third-party tray managers (which themselves act as replacement shells).
- Some tools hack undocumented registry blobs (
NotifyIconSettings), but these are version- and profile-specific, and NOT supported (high risk, break with updates).Practical Autounattend Snippet (For Max Range):
Create or edit theCode:<FirstLogonCommands> <SynchronousCommand wcm:action="add"> <Order>1</Order> <Description>Enable All Tray Icons (if supported)</Description> <CommandLine>reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer" /v EnableAutoTray /t REG_DWORD /d 0 /f</CommandLine> </SynchronousCommand> <SynchronousCommand wcm:action="add"> <Order>2</Order> <Description>Restart Explorer</Description> <CommandLine>cmd /c taskkill /f /im explorer.exe & start explorer.exe</CommandLine> </SynchronousCommand> <!-- Optional: Show instructions --> <SynchronousCommand wcm:action="add"> <Order>3</Order> <Description>Show Tray Icon Instructions</Description> <CommandLine>notepad.exe C:\SetupFiles\SHOW_ALL_TRAY_ICONS_README.txt</CommandLine> </SynchronousCommand> </FirstLogonCommands>.txtfile with friendly user instructions for the latest Windows 11 UI.
If Microsoft changes this in the future, or a new method is discovered, I’ll be happy to update you.
For now, manual user action is required after 22H2 for full tray icon visibility—no script can universally force it. Let me know if you’d like help preparing a user guide or optimizing unattended deployment for what’s possible!
<FirstLogonCommands> or run it interactively. Here’s a direct equivalent of your XML actions in PowerShell:# Set EnableAutoTray registry value to always show all tray icons (works only up to 21H2)
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name EnableAutoTray -Value 0
# Restart Explorer to apply settings
Stop-Process -Name explorer -Force
Start-Process explorer
# (Optional) Show tray icon instructions for 22H2+ users
$readme = "C:\SetupFiles\SHOW_ALL_TRAY_ICONS_README.txt"
if (Test-Path $readme) {
    notepad.exe $readme
}C:\SetupFiles\ShowAllTrayIcons.ps1):<FirstLogonCommands>
  <SynchronousCommand wcm:action="add">
    <Order>1</Order>
    <Description>Show All Tray Icons (PowerShell)</Description>
    <CommandLine>powershell.exe -ExecutionPolicy Bypass -File C:\SetupFiles\ShowAllTrayIcons.ps1</CommandLine>
  </SynchronousCommand>
</FirstLogonCommands>EnableAutoTray=0) for older builds (still safe for new ones—it just won’t have effect).