Diagnose A developer created a PowerShell script that collects comprehensive PC diagnostics, including CPU, RAM, GPU, storage, OS, motherboard, BIOS, and top processes. The script outputs the data in a structured format for analysis by an AI agent. | ============================================================ | | | PC DIAGNOSTICS SCRIPT - Run as Administrator | | | Paste the output back to AI Agent for analysis | | | ============================================================ | | | $sep = "=" 50 | | | Write-Host $sep | | | Write-Host " PC DIAGNOSTICS REPORT" | | | Write-Host " $ Get-Date " | | | Write-Host $sep | | | --- CPU --- | | | Write-Host " n CPU " | | | $cpu = Get-CimInstance Win32 Processor | | | Write-Host "Name : $ $cpu.Name " | | | Write-Host "Cores : $ $cpu.NumberOfCores physical / $ $cpu.NumberOfLogicalProcessors logical" | | | Write-Host "Max Speed : $ $cpu.MaxClockSpeed MHz" | | | Write-Host "Current Load : $ $cpu.LoadPercentage %" | | | --- Power Plan --- | | | Write-Host " n POWER PLAN " | | | powercfg /getactivescheme | | | powercfg /list | | | --- RAM --- | | | Write-Host " n RAM " | | | $sticks = Get-CimInstance Win32 PhysicalMemory | | | foreach $s in $sticks { | | | $gb = math ::Round $s.Capacity / 1GB, 0 | | | Write-Host "Slot $ $s.DeviceLocator : ${gb}GB | Rated: $ $s.Speed MHz | Running: $ $s.ConfiguredClockSpeed MHz | Mfg: $ $s.Manufacturer " | | | } | | | $totalRam = math ::Round Get-CimInstance Win32 ComputerSystem .TotalPhysicalMemory / 1GB, 1 | | | Write-Host "Total RAM : ${totalRam} GB" | | | --- GPU --- | | | Write-Host " n GPU " | | | $gpus = Get-CimInstance Win32 VideoController | | | foreach $g in $gpus { | | | $vram = if $g.AdapterRAM { math ::Round $g.AdapterRAM / 1GB, 1 } else { "N/A" } | | | Write-Host "Name : $ $g.Name " | | | Write-Host "VRAM : ${vram} GB" | | | Write-Host "Driver Ver : $ $g.DriverVersion " | | | Write-Host "Resolution : $ $g.CurrentHorizontalResolution x $ $g.CurrentVerticalResolution " | | | } | | | --- Storage --- | | | Write-Host " n STORAGE - Physical Disks " | | | Get-PhysicalDisk | ForEach-Object { | | | $sz = math ::Round $ .Size / 1GB, 0 | | | Write-Host "$ $ .FriendlyName | Type: $ $ .MediaType | ${sz}GB | Health: $ $ .HealthStatus " | | | } | | | Write-Host " n STORAGE - Drive Space " | | | Get-PSDrive -PSProvider FileSystem | ForEach-Object { | | | $used = math ::Round $ .Used / 1GB, 1 | | | $free = math ::Round $ .Free / 1GB, 1 | | | Write-Host "Drive $ $ .Name : Used=${used}GB Free=${free}GB" | | | } | | | --- OS fixed: use CimInstance for proper DateTime --- | | | Write-Host " n OPERATING SYSTEM " | | | $os = Get-CimInstance Win32 OperatingSystem | | | Write-Host "OS : $ $os.Caption $ $os.OSArchitecture " | | | Write-Host "Build : $ $os.BuildNumber " | | | $uptime = Get-Date - $os.LastBootUpTime | | | Write-Host "Uptime : $ math ::Floor $uptime.TotalHours h $ $uptime.Minutes m" | | | Write-Host "Virtual Mem : $ math ::Round $os.TotalVirtualMemorySize / 1MB, 1 GB" | | | --- Motherboard / BIOS --- | | | Write-Host " n MOTHERBOARD / BIOS " | | | $mb = Get-CimInstance Win32 BaseBoard | | | Write-Host "Manufacturer : $ $mb.Manufacturer " | | | Write-Host "Model : $ $mb.Product " | | | $bios = Get-CimInstance Win32 BIOS | | | Write-Host "BIOS Version : $ $bios.SMBIOSBIOSVersion " | | | $biosDate = $bios.ReleaseDate | | | Write-Host "BIOS Date : $ $biosDate.ToString 'yyyy-MM-dd' " | | | --- Top 15 CPU Processes --- | | | Write-Host " n TOP 15 CPU PROCESSES " | | | Get-Process | Sort-Object CPU -Descending | Select-Object -First 15 | ForEach-Object { | | | $c = math ::Round $ .CPU, 1 | | | $m = math ::Round $ .WorkingSet64 / 1MB, 0 | | | Write-Host " " + $ .ProcessName.PadRight 32 + "CPU: ${c}s RAM: ${m}MB" | | | } | | | --- Top 15 RAM Processes --- | | | Write-Host " n TOP 15 RAM PROCESSES " | | | Get-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 15 | ForEach-Object { | | | $m = math ::Round $ .WorkingSet64 / 1MB, 0 | | | Write-Host " " + $ .ProcessName.PadRight 32 + "RAM: ${m}MB" | | | } | | | --- Network show all present adapters, not just Up --- | | | Write-Host " n NETWORK ADAPTERS " | | | Get-NetAdapter | Where-Object { $ .Status -ne "Not Present" } | Sort-Object Status | ForEach-Object { | | | $speed = if $ .Status -eq "Up" { "Speed: $ $ .LinkSpeed " } else { "Speed: N/A" } | | | Write-Host " $ $ .Status.ToUpper .PadRight 12 $ $ .Name | $ $ .InterfaceDescription | $speed" | | | } | | | --- System Settings --- | | | Write-Host " n SYSTEM SETTINGS " | | | $hiberfil = Test-Path "C:\hiberfil.sys" | | | Write-Host "Hibernation file present : $hiberfil" | | | $gp = Get-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power" -ErrorAction SilentlyContinue | | | Write-Host "HiberbootEnabled Fast Startup : $ $gp.HiberbootEnabled " | | | --- Startup Programs fixed: check registry for enabled/disabled state --- | | | Write-Host " n STARTUP PROGRAMS " | | | Build a set of disabled startup item names from StartupApproved registry keys | | | $disabledNames = @{} | | | $approvedPaths = @ | | | "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", | | | "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run", | | | "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32", | | | "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run32", | | | "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder", | | | "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder" | | | | | | foreach $regPath in $approvedPaths { | | | if Test-Path $regPath { | | | $item = Get-Item $regPath | | | foreach $valName in $item.GetValueNames { | | | $data = $item.GetValue $valName | | | First byte: 02 = enabled, 03 = disabled | | | if $data -is byte -and $data.Length -gt 0 -and $data 0 -eq 3 { | | | $disabledNames $valName = $true | | | } | | | } | | | } | | | } | | | Get-CimInstance Win32 StartupCommand | ForEach-Object { | | | $state = if $disabledNames.ContainsKey $ .Name { "DISABLED" } else { "ENABLED" } | | | PSCustomObject @{ State = $state; Name = $ .Name; Command = $ .Command } | | | } | Sort-Object @{Expression={$ .State}; Descending=$true}, Name | ForEach-Object { | | | $label = if $ .State -eq "DISABLED" { " DISABLED " } else { " ENABLED " } | | | Write-Host " $label $ $ .Name | $ $ .Command " | | | } | | | --- 3rd Party Scheduled Tasks non-Microsoft, non-Disabled --- | | | Write-Host " n 3RD PARTY SCHEDULED TASKS Enabled only " | | | Get-ScheduledTask | Where-Object { | | | $ .TaskPath -notlike "\Microsoft\ " -and $ .State -ne "Disabled" | | | } | Sort-Object @{Expression={$ .State.ToString }; Descending=$true}, TaskName | ForEach-Object { | | | Write-Host " $ $ .State.ToString .ToUpper .PadRight 7 $ $ .TaskPath $ $ .TaskName " | | | } | | | Write-Host " n$sep" | | | Write-Host " END OF REPORT - Paste this output to Ai Agent" | | | Write-Host $sep |