Windows 11 PowerShell Diagnostics Cheat Sheet
Sidebar
Operating Systems ยท Windows 11 PowerShell Diagnostics Cheat Sheet
Read-only PowerShell one-liners for finding out what a Windows 11 PC is, what it is running and what has been going wrong. Every command here ran as a normal user (no administrator rights) on the PC this was written on (Windows 11 Pro, build 26300, Windows PowerShell 5.1) unless a line says otherwise; the commands that need administrator rights are marked. Nothing here changes a setting.
Who Is This PC?
Get-ComputerInfo -Property OsName,OsBuildNumber,CsProcessors,BiosVersionOS, build, processor and BIOS (slow, but one call; drop -Property for everything)systeminfoClassic summary: OS, install date, boot time, RAM, hotfixes, network cardsGet-CimInstance Win32_ComputerSystemManufacturer, model, RAM, domain/workgroupGet-CimInstance Win32_BIOSBIOS vendor, version and dateGet-CimInstance Win32_ProcessorCPU name, cores, logical processors, max clockGet-CimInstance Win32_OperatingSystemBuild, install date, last boot, memory fieldsUptime, Boot and Admin Check
(Get-CimInstance Win32_OperatingSystem).LastBootUpTimeWhen it last started(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTimeTime since then([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole('Administrator')True if this window has administrator rights (it was False here)Fast StartupA shutdown with Fast Startup on is partly a hibernate, so uptime can span shutdowns; restart rather than shut down to get a clean bootMemory
Get-CimInstance Win32_PhysicalMemoryEach module: capacity, rated Speed, ConfiguredClockSpeed, part numberGet-Counter '\Memory\Available MBytes'Available RAM (see the Memory Troubleshooting sheet)Get-CimInstance Win32_PageFileUsagePage file size and peakGet-Process | Sort-Object WorkingSet64 -Descending | Select-Object -First 10 Name, Id, WorkingSet64Top processes by RAMDisks and Volumes
Get-DiskDisks: number, name, size, partition style, healthGet-PhysicalDiskMedia type (SSD/HDD), HealthStatus, OperationalStatus. Healthy can coexist with thousands of logged errors: check the event log tooGet-VolumeDrive letters, file system, size and free spaceGet-PhysicalDisk | Get-StorageReliabilityCounterTemperature, wear, error totals: returned nothing here without administrator rightschkdsk D:Read-only check (no /f); may need administrator rights; not run hereProcesses, Services and Startup
Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, Id, CPUBusiest by total CPU secondsGet-Process | Sort-Object Handles -Descending | Select-Object -First 5 Name, Id, HandlesMost handlesGet-Service | Where-Object Status -eq 'Running'Running services (144 here)Get-CimInstance Win32_Service | Where-Object State -eq 'Running' | Select-Object Name, PathNameServices with the program each runs: spot unfamiliar onesGet-CimInstance Win32_StartupCommand | Select-Object Name, LocationPrograms that start at sign-inGet-ScheduledTask | Where-Object State -ne 'Disabled'Scheduled tasks that are enabled (181 here)Network
Get-NetAdapterAdapters: name, description, status, link speed. Here: only Ethernet is Up; Wi-Fi and four VPN adapters are DisconnectedGet-NetIPConfigurationIP addresses, gateway and DNS per interfaceipconfig /allThe classic equivalentTest-NetConnection example.com -Port 443Can this PC reach a host and port (makes a network request; not run here)Get-NetTCPConnection -State EstablishedCurrent connections (add -OwningProcess to link to programs; not run here)Updates, Devices and Security
Get-HotFix | Sort-Object InstalledOn -DescendingInstalled updates with dates (reads only some update types: the full history is on the Drivers & Updates sheet)Get-PnpDevice -PresentOnly | Where-Object Status -ne 'OK'Devices with a problem (none here)Get-MpComputerStatus | Select-Object AMServiceEnabled, RealTimeProtectionEnabled, AntivirusSignatureLastUpdatedMicrosoft Defender state. It reports Defender only, not other antivirus productsGet-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProductAntivirus products Windows knows about (client Windows only; not run here)Events (the Short Versions)
Get-WinEvent -FilterHashtable @{LogName='System'; Level=1,2; StartTime=(Get-Date).AddHours(-24)}Critical and Error events in the last 24 hoursGet-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Microsoft-Windows-Kernel-Power'; Id=41}Unexpected restartsGet-WinEvent -FilterHashtable @{LogName='System'; ProviderName='disk'} | Group-Object IdHow many of each disk eventMoreThe Event Viewer sheet has the event IDs that matter; the Crash Triage sheet the first ten minutesHabits That Prevent Trouble
-ErrorAction SilentlyContinueHide errors from a command you expect to fail on some items (e.g. access denied)| Format-List *See every property of an object, to find the one you need| Get-MemberList an object's properties and methods| Out-File -Encoding utf8 file.txtSave output readably (Windows PowerShell 5.1 defaults to other encodings for some redirects)Get-Help <cmd> -ExamplesExamples for any cmdletRead-only firstPrefer Get-* while investigating. Anything with Set-, Remove-, Stop- or Disable- changes the PC: note the undo firstRead-only does not mean harmless to read
These commands change nothing, but their output can include names, serial numbers, addresses and the programs you run. Check it before pasting into a forum or a support ticket.
Some answers need administrator rights
When a command returns nothing or Access denied, that is not the same as no problem found. The Crash Triage sheet shows what to copy from an administrator prompt.