# --- 1. "Always Show All Tray Icons" (works on 21H2/early 22H2; ignored on newer, but safe) ---
try {
    Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer" -Name EnableAutoTray -Value 0
    Stop-Process -Name explorer -Force
    Start-Sleep -Seconds 3
    Start-Process explorer
} catch {
    Write-Host "Tray icon tweak not supported on this build, continuing..."
}
# --- 2. Create System/Folder Shortcuts on Desktop ---
$wshell = New-Object -ComObject WScript.Shell
$desktop = [Environment]::GetFolderPath('Desktop')
# Classic system icons and user folders via shell argument shortcuts
$systemIcons = @(
    @{name="This PC";        args="shell:MyComputerFolder"},
    @{name="User's Files";   args="shell:UsersFilesFolder"},
    @{name="Network";        args="shell:NetworkPlacesFolder"},
    @{name="Control Panel";  args="shell:ControlPanelFolder"},
    @{name="Recycle Bin";    args="shell:RecycleBinFolder"},
    @{name="Desktop";        args="shell:Desktop"},
    @{name="Documents";      args="shell:Personal"},
    @{name="Downloads";      args="shell:Downloads"},
    @{name="Music";          args="shell:MyMusic"},
    @{name="Pictures";       args="shell:MyPictures"},
    @{name="Videos";         args="shell:MyVideo"},
    @{name="Home";           args="shell:Profile"},
    @{name="Gallery";        args="shell:MyPictures"}
)
foreach ($icon in $systemIcons) {
    $s = $wshell.CreateShortcut("$desktop\$($icon.name).lnk")
    $s.TargetPath = "$env:SystemRoot\explorer.exe"
    $s.Arguments = $icon.args
    $s.Save()
}
# File Explorer shortcut
$s = $wshell.CreateShortcut("$desktop\File Explorer.lnk")
$s.TargetPath = "$env:SystemRoot\explorer.exe"
$s.Save()
# --- 3. Admin utilities/tools shortcuts (as in Windows Tools) ---
$tools = @(
    @{name="Computer Management";      path="$env:SystemRoot\System32\CompMgmtLauncher.exe"},
    @{name="Component Services";       path="$env:SystemRoot\System32\comexp.msc"},
    @{name="Device Manager";           path="$env:SystemRoot\System32\devmgmt.msc"},
    @{name="Event Viewer";             path="$env:SystemRoot\System32\eventvwr.msc"},
    @{name="Command Prompt";           path="$env:SystemRoot\System32\cmd.exe"},
    @{name="Windows PowerShell";       path="$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe"},
    @{name="Windows PowerShell (x86)"; path="$env:SystemRoot\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"},
    @{name="Windows Defender Firewall";path="$env:SystemRoot\System32\wf.msc"},
    @{name="Performance Monitor";      path="$env:SystemRoot\System32\perfmon.exe"},
    @{name="iSCSI Initiator";          path="$env:SystemRoot\System32\iscsicpl.exe"},
    @{name="ODBC Data Sources (32-bit)";path="$env:SystemRoot\SysWOW64\odbcad32.exe"},
    @{name="ODBC Data Sources (64-bit)";path="$env:SystemRoot\System32\odbcad32.exe"},
    @{name="Services";                 path="$env:SystemRoot\System32\services.msc"},
    @{name="Disk Defragmenter";        path="$env:SystemRoot\System32\dfrgui.exe"},
    @{name="Disk Cleanup";             path="$env:SystemRoot\System32\cleanmgr.exe"},
    @{name="Task Scheduler";           path="$env:SystemRoot\System32\taskschd.msc"},
    @{name="System Configuration";     path="$env:SystemRoot\System32\msconfig.exe"},
    @{name="Resource Monitor";         path="$env:SystemRoot\System32\resmon.exe"},
    @{name="Registry Editor";          path="$env:SystemRoot\regedit.exe"},
    @{name="System Information";       path="$env:SystemRoot\System32\msinfo32.exe"},
    @{name="Steps Recorder";           path="$env:SystemRoot\System32\psr.exe"},
    @{name="Windows Media Player";     path="$env:ProgramFiles\Windows Media Player\wmplayer.exe"},
    @{name="Task Manager";             path="$env:SystemRoot\System32\taskmgr.exe"},
    @{name="Notepad";                  path="$env:SystemRoot\System32\notepad.exe"}
)
foreach ($l in $tools) {
    $sc = $wshell.CreateShortcut("$desktop\$($l.name).lnk")
    $sc.TargetPath = $l.path
    $sc.Save()
}
Write-Host "All requested shortcuts and (if supported) tray icon setting applied."