|
1 |
| -# Script para desocultar todos los iconos en la bandeja del sistema de Windows |
2 |
| - |
3 | 1 | 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 |
59 | 4 | }
|
60 | 5 |
|
61 | 6 | function W11_TrayNotify {
|
62 | 7 | foreach ($GUID in (Get-ChildItem -Path 'HKCU:\Control Panel\NotifyIconSettings' -Name)) {
|
63 | 8 | $ChildPath = "HKCU:\Control Panel\NotifyIconSettings\$($GUID)"
|
64 | 9 | $Exec = (Get-ItemProperty -Path $ChildPath -Name ExecutablePath -ErrorAction SilentlyContinue).ExecutablePath
|
65 |
| - # Desocultar todos los iconos |
66 | 10 | Set-ItemProperty -Path $ChildPath -Name IsPromoted -Value 1
|
67 | 11 | }
|
68 | 12 | }
|
69 | 13 |
|
70 |
| -# Detectar la versión de Windows y ejecutar la función correspondiente |
71 | 14 | $WinVer = [System.Environment]::OSVersion.Version.Build
|
72 | 15 | if ($WinVer -ge 22000) {
|
73 | 16 | W11_TrayNotify
|
|
0 commit comments