# WinDbg dump analysis — finds kd.exe dynamically, runs !analyze -v # Usage: powershell -ExecutionPolicy Bypass -File windbg-analyze.ps1 [-DumpFile path] # Defaults to newest minidump if no path given param( [string]$DumpFile ) $ErrorActionPreference = 'Stop' # Find kd.exe dynamically (version changes on updates) $kd = (Get-ChildItem "C:\Program Files\WindowsApps\Microsoft.WinDbg_*_x64__8wekyb3d8bbwe\amd64\kd.exe" -ErrorAction SilentlyContinue | Select-Object -First 1).FullName if (-not $kd) { Write-Error "WinDbg not found. Install: winget install Microsoft.WinDbg" exit 1 } Write-Host "Using: $kd" # Default to newest minidump if (-not $DumpFile) { $DumpFile = (Get-ChildItem C:\Windows\Minidump\*.dmp -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 1).FullName if (-not $DumpFile) { Write-Error "No minidumps found in C:\Windows\Minidump\" exit 1 } Write-Host "Analyzing newest dump: $DumpFile" } if (-not (Test-Path $DumpFile)) { Write-Error "Dump file not found: $DumpFile" exit 1 } & $kd -z $DumpFile -c "!analyze -v; q"