crash-sentinel: A Black Box for Windows Power-Loss Crashes
crash-sentinel is a pure-PowerShell crash monitor for Windows, built for exactly the case where the screen suddenly goes black, the machine loses power, and after the reboot all you get is a single Kernel-Power Event 41. Event 41 only tells you “the system didn’t shut down cleanly” — it doesn’t tell you why. crash-sentinel does two things: it records the scene before the crash, and it automatically pins down the cause of death after.
Pure PowerShell 5.1, zero dependencies — you don’t need to install a pile of monitoring software just to watch a temperature. GPU data comes from nvidia-smi (which you already have if the NVIDIA driver is installed), CPU load comes from performance counters, and CPU temperature is read from the ACPI thermal zone — all of it is already on the system. Double-click run.bat and it runs, sampling GPU/CPU temperature, power draw, and load every 5 seconds, writing each reading into a timestamped CSV. The console is color-coded: green for normal, yellow for warm, red for danger, with a beep on danger, so a glance out of the corner of your eye tells you the state.
The key point is that a power loss can’t lose data. Since the whole thing you’re trying to catch is a sudden power cut, log writes can never rely on buffering — the last few seconds sitting in memory unflushed will all vanish the instant power drops, and the monitoring would have been for nothing. So every reading is flushed to disk immediately, even at the cost of extra IO.
After a crash-and-reboot, run CrashReport.ps1: it first goes to the event log to find Event ID 41 to confirm it really was an unexpected power loss, then digs through the most recent monitoring log, pulls out the few minutes before the crash to characterize it, and produces a .txt for a quick scan and an .html to see the curves. A report looks like this:
DIAGNOSIS:
THERMAL THROTTLE CRASH: GPU hit critical temp (86C).
Sustained near-max temps caused VRM/power delivery to overload.
RECOMMENDATIONS:
- Cap frame rate to reduce sustained GPU load
- Limit GPU power target to 80-85%
- Improve laptop ventilation
On my own machine the GPU was sitting at 80-something degrees for long stretches with power draw topping out at 160W — it wasn’t the software blowing up, it was the heat and power delivery that couldn’t hold up. After I capped the power limit to 85% and locked the frame rate, the power-loss crashes stopped.
There are gotchas too. At first the CPU temperature barely moved; digging in, the ACPI thermal zone reads the package temperature rather than the core die temperature, and some laptops are on the conservative side, so I just went with GPU temperature and power draw as the primary metrics — those two are the real culprits. Thresholds, sampling interval, and log path are all in settings.json, so there’s no need to touch the script. Run setup.bat once as administrator to install two scheduled tasks: one that starts monitoring automatically at login, and one that checks for a crash at boot and produces a report if there was one. For now it only supports NVIDIA cards, since the diagnosis chain is built on nvidia-smi; I don’t have an AMD card on hand, so that’s on hold.