# Diagnose

> Source: <https://gist.github.com/tommykho/a75c41650f8618180bff2f3a153a41f7>
> Published: 2026-06-22 04:45:51+00:00

| # ============================================================ | |
| # 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 |
