Skip to content

Commit 58e6991

Browse files
committed
Added RigReport Script
1 parent e3da04d commit 58e6991

File tree

1 file changed

+206
-0
lines changed

1 file changed

+206
-0
lines changed

RigReport.ps1

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
# 1. Load Windows Forms & Drawing
2+
Add-Type -AssemblyName System.Windows.Forms
3+
Add-Type -AssemblyName System.Drawing
4+
5+
# --- NOTIFICATION FUNCTION ---
6+
function Show-RigNotification ($Message) {
7+
$notif = New-Object Windows.Forms.NotifyIcon
8+
$path = (Get-Process -id $PID).Path
9+
$notif.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
10+
$notif.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info
11+
$notif.BalloonTipTitle = "RigReport"
12+
$notif.BalloonTipText = $Message
13+
$notif.Visible = $true
14+
$notif.ShowBalloonTip(2000)
15+
$cleanupTimer = New-Object Windows.Forms.Timer
16+
$cleanupTimer.Interval = 3000
17+
$cleanupTimer.Add_Tick({
18+
$this.Stop()
19+
$notif.Visible = $false
20+
$notif.Dispose()
21+
$this.Dispose()
22+
}.GetNewClosure())
23+
$cleanupTimer.Start()
24+
}
25+
26+
# --- FIXED EXPORT FORMATTER ---
27+
function Get-RigSpecSheet ($Data) {
28+
$sb = New-Object System.Text.StringBuilder
29+
$sb.AppendLine("==================================================") | Out-Null
30+
$sb.AppendLine("RigReport Summary") | Out-Null
31+
$sb.AppendLine("Generated on: $(Get-Date -Format 'MM-dd-yyyy HH:mm:ss')") | Out-Null
32+
$sb.AppendLine("==================================================") | Out-Null
33+
$sb.AppendLine("") | Out-Null
34+
35+
foreach ($prop in $Data.PSObject.Properties) {
36+
$label = "$($prop.Name) :".PadRight(25)
37+
$value = if ($prop.Value) { $prop.Value.ToString() } else { "N/A" }
38+
$sb.AppendLine("$label $value") | Out-Null
39+
}
40+
41+
$sb.AppendLine("") | Out-Null
42+
$sb.Append("==================================================") | Out-Null
43+
return $sb.ToString()
44+
}
45+
46+
# 2. Gather Data
47+
$os = Get-CimInstance Win32_OperatingSystem -ErrorAction SilentlyContinue
48+
$cpu = Get-CimInstance Win32_Processor -ErrorAction SilentlyContinue
49+
$disk = Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" -ErrorAction SilentlyContinue
50+
$bios = Get-CimInstance Win32_BIOS -ErrorAction SilentlyContinue
51+
$bb = Get-CimInstance Win32_BaseBoard -ErrorAction SilentlyContinue
52+
$ramData = Get-CimInstance Win32_PhysicalMemory -ErrorAction SilentlyContinue
53+
$memArray = Get-CimInstance Win32_PhysicalMemoryArray -ErrorAction SilentlyContinue
54+
55+
$ramCount = ($ramData | Measure-Object).Count
56+
$totalSlots = $memArray.MemoryDevices
57+
$ramTotalGB = [Math]::Round(($ramData | Measure-Object -Property Capacity -Sum).Sum / 1GB, 2)
58+
$ramSpeed = ($ramData.ConfiguredClockSpeed | Select-Object -First 1)
59+
$ramVendors = ($ramData.Manufacturer | Select-Object -Unique) -join " / "
60+
61+
$channelMode = switch ($ramCount) {
62+
1 { "Single Channel" }
63+
2 { "Dual Channel" }
64+
4 { "Quad Channel" }
65+
default { "$ramCount Sticks" }
66+
}
67+
68+
$gpuNames = (Get-CimInstance Win32_VideoController).Caption -join ", "
69+
$biosDate = if ($bios.ReleaseDate) { $bios.ReleaseDate.ToString("MM-dd-yyyy") } else { "Unknown" }
70+
71+
$script:results = [PSCustomObject]@{
72+
'OS' = $os.Caption
73+
'Rig Name' = $env:COMPUTERNAME
74+
'CPU' = $cpu.Name.Trim()
75+
'RAM (Total GB)' = $ramTotalGB
76+
'RAM Config' = "$ramCount / $totalSlots Slots ($channelMode)"
77+
'RAM Details' = "$($ramVendors) ($($ramSpeed) MHz)"
78+
'GPU' = $gpuNames
79+
'Free Drive Space' = "$([Math]::Round($disk.FreeSpace / 1GB, 2)) GB"
80+
'Motherboard' = "$($bb.Manufacturer) $($bb.Product)"
81+
'Board Revision' = $bb.Version
82+
'BIOS Version' = $bios.SMBIOSBIOSVersion
83+
'BIOS Date' = $biosDate
84+
'Boot Mode' = if ($env:Firmware_Type) { $env:Firmware_Type } else { "UEFI" }
85+
}
86+
87+
# 3. Create Form
88+
$form = New-Object System.Windows.Forms.Form
89+
$form.Text = "RigReport: $env:COMPUTERNAME"
90+
$form.Size = New-Object System.Drawing.Size(550,550)
91+
$form.StartPosition = "CenterScreen"
92+
$form.FormBorderStyle = "FixedDialog"
93+
$form.MaximizeBox = $false
94+
95+
$titleLabel = New-Object System.Windows.Forms.Label
96+
$titleLabel.Text = "RigReport v1.0.0"
97+
$titleLabel.Font = New-Object System.Drawing.Font("Segoe UI", 16, [System.Drawing.FontStyle]::Bold)
98+
$titleLabel.Size = New-Object System.Drawing.Size(400, 40)
99+
$titleLabel.Location = New-Object System.Drawing.Point(25, 15)
100+
$form.Controls.Add($titleLabel)
101+
102+
$listView = New-Object System.Windows.Forms.ListView
103+
$listView.View = "Details"
104+
$listView.HeaderStyle = "None"
105+
$listView.Width = 490
106+
$listView.Height = 350
107+
$listView.Location = New-Object System.Drawing.Point(25, 60)
108+
$listView.FullRowSelect = $true
109+
$listView.BorderStyle = "FixedSingle"
110+
$listView.Columns.Add("P", 160) | Out-Null
111+
$listView.Columns.Add("V", 300) | Out-Null
112+
113+
foreach ($prop in $script:results.PSObject.Properties) {
114+
$item = New-Object System.Windows.Forms.ListViewItem($prop.Name)
115+
$valStr = if ($prop.Value) { $prop.Value.ToString() } else { "" }
116+
$item.SubItems.Add($valStr) | Out-Null
117+
$listView.Items.Add($item) | Out-Null
118+
}
119+
$listView.AutoResizeColumn(1, [System.Windows.Forms.ColumnHeaderAutoResizeStyle]::ColumnContent)
120+
$form.Controls.Add($listView)
121+
122+
# --- ICON DRAWING LOGIC ---
123+
function Get-SunImage ([System.Drawing.Color]$Color, [bool]$IsHollow) {
124+
$bmp = New-Object System.Drawing.Bitmap(32, 32)
125+
$g = [System.Drawing.Graphics]::FromImage($bmp)
126+
$g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
127+
$pen = New-Object System.Drawing.Pen($Color, 2)
128+
if ($IsHollow) { $g.DrawEllipse($pen, 10, 10, 12, 12) }
129+
else { $brush = New-Object System.Drawing.SolidBrush($Color); $g.FillEllipse($brush, 10, 10, 12, 12) }
130+
$g.DrawLine($pen, 16, 4, 16, 8); $g.DrawLine($pen, 16, 24, 16, 28)
131+
$g.DrawLine($pen, 4, 16, 8, 16); $g.DrawLine($pen, 24, 16, 28, 16)
132+
$g.DrawLine($pen, 8, 8, 11, 11); $g.DrawLine($pen, 21, 21, 24, 24)
133+
$g.DrawLine($pen, 24, 8, 21, 11); $g.DrawLine($pen, 11, 21, 8, 24)
134+
$g.Dispose(); return $bmp
135+
}
136+
137+
# --- THEME SWITCHER ---
138+
$script:isDarkMode = $true
139+
140+
$themeBtn = New-Object System.Windows.Forms.Button
141+
$themeBtn.Size = New-Object System.Drawing.Size(40, 40)
142+
$themeBtn.Location = New-Object System.Drawing.Point(475, 12)
143+
$themeBtn.FlatStyle = "Flat"
144+
$themeBtn.FlatAppearance.BorderSize = 0
145+
$themeBtn.Cursor = [System.Windows.Forms.Cursors]::Hand
146+
147+
function Update-Theme {
148+
if ($script:isDarkMode) {
149+
$form.BackColor = [System.Drawing.Color]::FromArgb(32, 32, 32)
150+
$titleLabel.ForeColor = [System.Drawing.Color]::White
151+
$listView.BackColor = [System.Drawing.Color]::FromArgb(45, 45, 45)
152+
$listView.ForeColor = [System.Drawing.Color]::White
153+
$themeBtn.Image = Get-SunImage -Color ([System.Drawing.Color]::White) -IsHollow $false
154+
} else {
155+
$form.BackColor = [System.Drawing.Color]::WhiteSmoke
156+
$titleLabel.ForeColor = [System.Drawing.Color]::Black
157+
$listView.BackColor = [System.Drawing.Color]::White
158+
$listView.ForeColor = [System.Drawing.Color]::Black
159+
$themeBtn.Image = Get-SunImage -Color ([System.Drawing.Color]::Black) -IsHollow $true
160+
}
161+
}
162+
163+
$themeBtn.Add_Click({
164+
$script:isDarkMode = !$script:isDarkMode
165+
Update-Theme
166+
})
167+
$form.Controls.Add($themeBtn)
168+
169+
# --- ACTION BUTTONS ---
170+
$copyBtn = New-Object System.Windows.Forms.Button
171+
$copyBtn.Text = "Copy All"
172+
$copyBtn.Size = New-Object System.Drawing.Size(235, 45)
173+
$copyBtn.Location = New-Object System.Drawing.Point(25, 430)
174+
$copyBtn.Font = New-Object System.Drawing.Font("Segoe UI", 10, [System.Drawing.FontStyle]::Bold)
175+
$copyBtn.BackColor = [System.Drawing.Color]::LightSlateGray
176+
$copyBtn.ForeColor = [System.Drawing.Color]::White
177+
$copyBtn.FlatStyle = "Flat"
178+
$copyBtn.Add_Click({
179+
$txt = Get-RigSpecSheet -Data $script:results
180+
[System.Windows.Forms.Clipboard]::SetText($txt)
181+
Show-RigNotification -Message "Specs copied to clipboard!"
182+
})
183+
$form.Controls.Add($copyBtn)
184+
185+
$exportBtn = New-Object System.Windows.Forms.Button
186+
$exportBtn.Text = "Export Specs"
187+
$exportBtn.Size = New-Object System.Drawing.Size(235, 45)
188+
$exportBtn.Location = New-Object System.Drawing.Point(280, 430)
189+
$exportBtn.Font = New-Object System.Drawing.Font("Segoe UI", 10, [System.Drawing.FontStyle]::Bold)
190+
$exportBtn.BackColor = [System.Drawing.Color]::DodgerBlue
191+
$exportBtn.ForeColor = [System.Drawing.Color]::White
192+
$exportBtn.FlatStyle = "Flat"
193+
$exportBtn.Add_Click({
194+
$saveDialog = New-Object System.Windows.Forms.SaveFileDialog
195+
$saveDialog.Filter = "Text Files (*.txt)|*.txt"
196+
$saveDialog.FileName = "RigReport_$($env:COMPUTERNAME)"
197+
if ($saveDialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
198+
$txt = Get-RigSpecSheet -Data $script:results
199+
$txt | Set-Content -Path $saveDialog.FileName
200+
Show-RigNotification -Message "Report saved successfully!"
201+
}
202+
})
203+
$form.Controls.Add($exportBtn)
204+
205+
Update-Theme
206+
$form.ShowDialog() | Out-Null

0 commit comments

Comments
 (0)