public/Show-OctaDashboard.ps1
|
function Show-OctaDashboard { <# .SYNOPSIS Read-only system info panel: CPU, RAM, GPU, storage, OS. FR-042. Makes zero changes. #> [CmdletBinding()] param() $cpu = Get-CimInstance -ClassName Win32_Processor -ErrorAction SilentlyContinue | Select-Object -First 1 $os = Get-CimInstance -ClassName Win32_OperatingSystem -ErrorAction SilentlyContinue $gpus = @(Get-CimInstance -ClassName Win32_VideoController -ErrorAction SilentlyContinue) $drives = @(Get-CimInstance -ClassName Win32_LogicalDisk -Filter 'DriveType=3' -ErrorAction SilentlyContinue) $ramTotalGb = [Math]::Round($os.TotalVisibleMemorySize / 1MB, 1) $ramFreeGb = [Math]::Round($os.FreePhysicalMemory / 1MB, 1) $report = [pscustomobject]@{ Cpu = [pscustomobject]@{ Name = $cpu.Name; LoadPercentage = $cpu.LoadPercentage } Ram = [pscustomobject]@{ TotalGB = $ramTotalGb; FreeGB = $ramFreeGb; UsedGB = [Math]::Round($ramTotalGb - $ramFreeGb, 1) } Gpu = @($gpus | ForEach-Object { $_.Name }) Storage = @($drives | ForEach-Object { [pscustomobject]@{ Drive = $_.DeviceID FreeGB = [Math]::Round($_.FreeSpace / 1GB, 1) SizeGB = [Math]::Round($_.Size / 1GB, 1) } }) Os = [pscustomobject]@{ Caption = $os.Caption; Version = $os.Version; BuildNumber = $os.BuildNumber } } Write-Host "CPU: $($report.Cpu.Name) ($($report.Cpu.LoadPercentage)% load)" Write-Host "RAM: $($report.Ram.UsedGB) GB used / $($report.Ram.TotalGB) GB total ($($report.Ram.FreeGB) GB free)" Write-Host "GPU: $($report.Gpu -join ', ')" foreach ($d in $report.Storage) { Write-Host "Disk $($d.Drive): $($d.FreeGB) GB free / $($d.SizeGB) GB total" } Write-Host "OS: $($report.Os.Caption) (build $($report.Os.BuildNumber))" return $report } |