Skip to content

Commit eacee77

Browse files
committed
Add SuperOps tray icon visibility script
1 parent cbaadac commit eacee77

1 file changed

Lines changed: 176 additions & 0 deletions

File tree

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
$ErrorActionPreference = 'Stop'
2+
<#
3+
██╗ ██╗███╗ ███╗███████╗██╗ ██╗ █████╗ ██╗ ██╗██╗ ██╗
4+
██║ ██║████╗ ████║██╔════╝██║ ██║██╔══██╗██║ ██║██║ ██╔╝
5+
██║ ██║██╔████╔██║█████╗ ███████║███████║██║ █╗ ██║█████╔╝
6+
██║ ██║██║╚██╔╝██║██╔══╝ ██╔══██║██╔══██║██║███╗██║██╔═██╗
7+
███████╗██║██║ ╚═╝ ██║███████╗██║ ██║██║ ██║╚███╔███╔╝██║ ██╗
8+
╚══════╝╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝
9+
================================================================================
10+
SCRIPT : SuperOps Tray Icon Show v1.0.0
11+
AUTHOR : Limehawk.io
12+
DATE : December 2024
13+
USAGE : .\superops_tray_icon_show.ps1
14+
================================================================================
15+
FILE : superops_tray_icon_show.ps1
16+
--------------------------------------------------------------------------------
17+
README
18+
--------------------------------------------------------------------------------
19+
PURPOSE
20+
21+
Promotes the SuperOps agent tray icon to be visible in the system tray
22+
instead of hidden in the overflow area. Searches the NotifyIconSettings
23+
registry for any entry containing "superops" and sets IsPromoted=1.
24+
25+
DATA SOURCES & PRIORITY
26+
27+
- Windows Registry: HKCU:\Control Panel\NotifyIconSettings
28+
29+
REQUIRED INPUTS
30+
31+
All inputs are hardcoded in the script body:
32+
- $searchPattern: Text to match in registry values (default: *superops*)
33+
34+
SETTINGS
35+
36+
Change $searchPattern if you need to match a different application name.
37+
38+
BEHAVIOR
39+
40+
The script performs the following actions in order:
41+
1. Enumerates all subkeys under NotifyIconSettings
42+
2. Searches each key's values for the search pattern
43+
3. Sets IsPromoted=1 for matching keys (makes icon visible)
44+
45+
PREREQUISITES
46+
47+
- PowerShell 5.1 or later
48+
- Must run as logged-in user (HKCU registry)
49+
- SuperOps agent must have run at least once (to create tray icon entry)
50+
51+
SECURITY NOTES
52+
53+
- No secrets exposed in output
54+
- Only modifies current user's notification settings
55+
- No admin rights required
56+
57+
ENDPOINTS
58+
59+
- Not applicable (local operations only)
60+
61+
EXIT CODES
62+
63+
0 = Success
64+
1 = Failure (error occurred)
65+
66+
EXAMPLE RUN
67+
68+
[ SEARCH TRAY ICONS ]
69+
--------------------------------------------------------------
70+
Searching for: *superops*
71+
Found 12 notification icon entries
72+
Set IsPromoted=1 for key: 7369737...
73+
74+
[ FINAL STATUS ]
75+
--------------------------------------------------------------
76+
Result : SUCCESS
77+
Icons promoted : 1
78+
79+
[ SCRIPT COMPLETE ]
80+
--------------------------------------------------------------
81+
82+
--------------------------------------------------------------------------------
83+
CHANGELOG
84+
--------------------------------------------------------------------------------
85+
2024-12-28 v1.0.0 Initial release
86+
================================================================================
87+
#>
88+
Set-StrictMode -Version Latest
89+
90+
# ============================================================================
91+
# SETTINGS
92+
# ============================================================================
93+
94+
# Search pattern - change to match different application
95+
$searchPattern = '*superops*'
96+
97+
# ============================================================================
98+
# STATE VARIABLES
99+
# ============================================================================
100+
$iconsPromoted = 0
101+
$errorOccurred = $false
102+
103+
# ============================================================================
104+
# SEARCH TRAY ICONS
105+
# ============================================================================
106+
Write-Host ""
107+
Write-Host "[ SEARCH TRAY ICONS ]"
108+
Write-Host "--------------------------------------------------------------"
109+
Write-Host "Searching for: $searchPattern"
110+
111+
$notifyIconPath = "HKCU:\Control Panel\NotifyIconSettings"
112+
113+
if (-not (Test-Path $notifyIconPath)) {
114+
Write-Host "NotifyIconSettings key not found"
115+
Write-Host ""
116+
Write-Host "[ FINAL STATUS ]"
117+
Write-Host "--------------------------------------------------------------"
118+
Write-Host "Result : NO ACTION"
119+
Write-Host "The notification icon settings registry key does not exist"
120+
Write-Host ""
121+
Write-Host "[ SCRIPT COMPLETE ]"
122+
Write-Host "--------------------------------------------------------------"
123+
exit 0
124+
}
125+
126+
$subKeys = Get-ChildItem -Path $notifyIconPath -ErrorAction SilentlyContinue
127+
Write-Host "Found $($subKeys.Count) notification icon entries"
128+
129+
foreach ($key in $subKeys) {
130+
try {
131+
$values = Get-ItemProperty -Path $key.PSPath
132+
$matchFound = $false
133+
134+
foreach ($property in $values.PSObject.Properties) {
135+
if ($property.Value -is [string] -and $property.Value -like $searchPattern) {
136+
$matchFound = $true
137+
break
138+
}
139+
}
140+
141+
if ($matchFound) {
142+
Set-ItemProperty -Path $key.PSPath -Name "IsPromoted" -Value 1 -Type DWord
143+
Write-Host "Set IsPromoted=1 for key: $($key.PSChildName)"
144+
$iconsPromoted++
145+
}
146+
} catch {
147+
Write-Host "Error reading key: $($key.PSChildName)"
148+
$errorOccurred = $true
149+
}
150+
}
151+
152+
# ============================================================================
153+
# FINAL STATUS
154+
# ============================================================================
155+
Write-Host ""
156+
Write-Host "[ FINAL STATUS ]"
157+
Write-Host "--------------------------------------------------------------"
158+
159+
if ($iconsPromoted -eq 0) {
160+
Write-Host "Result : NO MATCH"
161+
Write-Host "No tray icons matching '$searchPattern' were found"
162+
Write-Host ""
163+
Write-Host "The SuperOps agent may not have run yet, or the icon"
164+
Write-Host "entry uses a different name in the registry."
165+
} elseif ($errorOccurred) {
166+
Write-Host "Result : PARTIAL SUCCESS"
167+
Write-Host "Icons promoted : $iconsPromoted"
168+
} else {
169+
Write-Host "Result : SUCCESS"
170+
Write-Host "Icons promoted : $iconsPromoted"
171+
}
172+
173+
Write-Host ""
174+
Write-Host "[ SCRIPT COMPLETE ]"
175+
Write-Host "--------------------------------------------------------------"
176+
exit 0

0 commit comments

Comments
 (0)