Skip to content

Commit 775cc7f

Browse files
authored
Update Enable-AutoTray.ps1
1 parent abae21f commit 775cc7f

File tree

1 file changed

+2
-59
lines changed

1 file changed

+2
-59
lines changed

Scripts/Others/Enable-AutoTray.ps1

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,16 @@
1-
# Script para desocultar todos los iconos en la bandeja del sistema de Windows
2-
31
function W10_TrayNotify {
4-
$TrayNotifyKey = 'HKCU:\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify'
5-
$HeaderSize = 20
6-
$BlockSize = 1640
7-
$SettingOffset = 528
8-
9-
$Restart = $false
10-
11-
function GetStreamData {
12-
param([byte[]] $stream)
13-
$builder = New-Object System.Text.StringBuilder
14-
$stream | ForEach-Object { [void]$builder.Append(('{0:x2}' -f $_)) }
15-
return $builder.ToString()
16-
}
17-
18-
function BuildItemTable {
19-
param([byte[]] $stream)
20-
$table = @{}
21-
for ($x = 0; $x -lt (($stream.Count - $HeaderSize) / $BlockSize); $x++) {
22-
$offset = $HeaderSize + ($x * $BlockSize)
23-
$table.Add($offset, $stream[$offset..($offset + ($BlockSize - 1))])
24-
}
25-
return $table
26-
}
27-
28-
function rot13 {
29-
param (
30-
[parameter(valueFromPipeline = $true, mandatory = $true)]
31-
[string] $text
32-
)
33-
[string] $r = ''
34-
foreach ($c in $text.ToCharArray()) {
35-
[int] $n = $c
36-
if (($n -ge 97 -and $n -le 109) -or ($n -ge 65 -and $n -le 77)) { $r += [char] ($n + 13) }
37-
elseif (($n -ge 110 -and $n -le 122) -or ($n -ge 78 -and $n -le 90)) { $r += [char] ($n - 13) }
38-
else { $r += $c }
39-
}
40-
return $r
41-
}
42-
43-
$TrayNotifyPath = (Get-Item $TrayNotifyKey).PSPath
44-
$stream = (Get-ItemProperty $TrayNotifyPath).IconStreams
45-
$table = BuildItemTable $stream
46-
47-
foreach ($key in $table.Keys) {
48-
$item = [Text.Encoding]::Unicode.GetString($table[$key]).ToLower()
49-
# Desocultar todos los iconos
50-
$Setting = 2
51-
$stream[$key + $SettingOffset] = $Setting
52-
Set-ItemProperty $TrayNotifyPath -Name IconStreams -Value $stream
53-
$Restart = $true
54-
}
55-
56-
if ($Restart) {
57-
Get-Process -Name explorer | Stop-Process
58-
}
2+
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer EnableAutoTray 0
3+
ps explorer | kill
594
}
605

616
function W11_TrayNotify {
627
foreach ($GUID in (Get-ChildItem -Path 'HKCU:\Control Panel\NotifyIconSettings' -Name)) {
638
$ChildPath = "HKCU:\Control Panel\NotifyIconSettings\$($GUID)"
649
$Exec = (Get-ItemProperty -Path $ChildPath -Name ExecutablePath -ErrorAction SilentlyContinue).ExecutablePath
65-
# Desocultar todos los iconos
6610
Set-ItemProperty -Path $ChildPath -Name IsPromoted -Value 1
6711
}
6812
}
6913

70-
# Detectar la versión de Windows y ejecutar la función correspondiente
7114
$WinVer = [System.Environment]::OSVersion.Version.Build
7215
if ($WinVer -ge 22000) {
7316
W11_TrayNotify

0 commit comments

Comments
 (0)