Generating crash dump reports with PowerShell

I’ve been using the new Windows scripting language PowerShell.  I’ve also been having a lot of problems with my workstation;  ever since I found my machine overheating–due to old, slow fans, it’s never been the same since, averaging a crash a day.  Is it just the hardware?  Is it a bad driver?  Did I just not seat the cards correctly last time I opened it?
I use Microsoft’s Debugging Tools For Windows to diagnose crashes for SATV’s servers and other machines and I was getting tired of going to WinDbg and putting in the same commands every time I needed to look at a crash dump.
Here’s my first PowerShell script, a simple wrapper for KD, the command line debugger.
# crashreport.ps1
# Create debug analysis logs using KD
# D. Moisan 5/24/2006
# Usage: crashreport <dumpfile>
# Input: <dumpfile> can be a full memory dump, kernel dump or minidump
# Output: Log file to standard output
# Note:  Debugging Tools for Windows must be installed
# in its default directory (Program Files\Debugging Tools For Windows)
if ($Args.Count -eq 0) {
   "Usage: crashreport <dumpfile>"
   exit }
set-alias kd $Env:ProgramFiles"\Debugging Tools For Windows\kd.exe"
# Debug commands are specified here.  See the Debugging Tools For
# Windows for more details
# Commands are:  !analyze -v    Verbose analysis of the crash
#                kv             Stacktrace
#                !process       Current process and thread at crash
#                lmf            List loaded modules and file paths
#                q              quit KD (or else KD will keep running)
$debugcommands = "`"!analyze -v; kv; !process; lmf; q`""
"Using debug commands: " + $debugcommands
"Generating debug output"
$crashdumpfile = $Args[0]
"Using crash dump file: " + $crashdumpfile
# Execute kd with commands
kd -c $debugcommands -noshell -z $Args[0]
"Debug Output to log file: " + $debugoutputfile

Take care,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s