KMODE_EXCEPTION_NOT_HANDLED on Windows Server 2012 R2: Complete Troubleshooting Guide
Fix KMODE_EXCEPTION_NOT_HANDLED BSOD on Windows Server 2012 R2, 2019, and 2022. Step-by-step diagnosis, driver fixes, and registry repairs covered.
- KMODE_EXCEPTION_NOT_HANDLED (Stop Code 0x0000001E) occurs when a kernel-mode program generates an exception that the error handler cannot catch, most commonly caused by a faulty driver, corrupted system file, or defective RAM.
- CRITICAL_PROCESS_DIED (0x000000EF) and SYSTEM_SERVICE_EXCEPTION (0x0000003B) are closely related BSODs sharing many root causes including driver conflicts, Windows Update failures, and hardware faults.
- Quick Fix Summary: Boot into Safe Mode, run 'verifier /standard /all' to isolate bad drivers, execute 'sfc /scannow' and 'DISM /Online /Cleanup-Image /RestoreHealth' to repair system files, then update or roll back the offending driver identified in the memory dump.
| Method | When to Use | Time | Risk |
|---|---|---|---|
| Driver Verifier (verifier.exe) | Suspect a faulty third-party driver is triggering the BSOD | 30–90 min (requires reboot cycles) | Medium – may cause additional BSODs intentionally to identify culprit |
| SFC + DISM System File Repair | System files are corrupted after a failed Windows Update or malware event | 20–45 min | Low – non-destructive, safe to run on production after hours |
| Windows Memory Diagnostic / MemTest86 | BSOD occurs across multiple drivers or randomly without pattern | 2–8 hours (full pass) | Low – read-only hardware test, no data risk |
| Driver Rollback via Device Manager | BSOD started after a specific driver or Windows Update was installed | 5–15 min | Low – restores previous known-good driver version |
| Clean Boot / Selective Startup | Third-party services or startup programs may conflict with kernel | 15–30 min | Low – disables non-Microsoft services temporarily |
| Windows Server In-Place Upgrade Repair | Severe corruption; SFC and DISM cannot resolve missing components | 1–3 hours | Medium – requires installation media; preserves data but reconfigures OS |
| Full System Restore / Snapshot Rollback | Virtualized environment with recent known-good snapshot available | 10–30 min depending on hypervisor | Low – data changes since snapshot will be lost |
Understanding the Error
When a Windows Server displays the blue screen with the message KMODE_EXCEPTION_NOT_HANDLED (Stop Code: 0x0000001E), it means a kernel-mode process — typically a device driver or core OS component — raised an exception (such as an access violation or illegal instruction) that the Windows kernel's exception dispatcher could not handle gracefully. Unlike user-mode crashes that merely terminate an application, a kernel-mode exception has no safe recovery path, so Windows halts immediately to prevent data corruption.
The exact text you will see on screen reads:
Your PC ran into a problem and needs to restart.
Stop Code: KMODE_EXCEPTION_NOT_HANDLED
On older Windows Server 2012 R2 systems using the classic blue screen, the message appears as:
*** STOP: 0x0000001E (0xFFFFFFFFC0000005, 0xFFFFF80000B9A9D8, 0x0000000000000000, 0x0000000000000040)
KMODE_EXCEPTION_NOT_HANDLED
The four parameters in parentheses are critical: the first (0xC0000005) is the exception code for an Access Violation, meaning the kernel tried to read or write an invalid memory address. The second parameter is the address of the instruction that caused the fault, which you can resolve to a specific driver using WinDbg.
Related errors you may encounter on the same or similar servers include:
- CRITICAL_PROCESS_DIED (0x000000EF) — A critical Windows process such as lsass.exe, smss.exe, or csrss.exe terminated unexpectedly.
- SYSTEM_SERVICE_EXCEPTION (0x0000003B) — An exception occurred during the execution of a routine transitioning from non-privileged to privileged code, frequently seen on Windows Server 2019 and 2022 after driver updates.
- IRQL_NOT_LESS_OR_EQUAL (0x0000000A) — Often co-occurs with KMODE errors when a driver accesses pageable memory at a raised interrupt request level.
Step 1: Capture and Analyze the Memory Dump
Before making any changes, collect diagnostic data from the crash dump file. By default, Windows Server writes a kernel memory dump to %SystemRoot%\MEMORY.DMP.
Enable automatic memory dumps if not already configured:
- Open System Properties → Advanced → Startup and Recovery → Settings.
- Under Write Debugging Information, select Kernel memory dump or Complete memory dump.
- Ensure Automatically restart is checked so the server reboots after a BSOD.
Analyze the dump with WinDbg: Download WinDbg from the Windows SDK or install via winget:
winget install Microsoft.WinDbg
Open the dump file:
windbg -z C:\Windows\MEMORY.DMP
In the WinDbg command window, run:
!analyze -v
This produces output identifying the failing module. Look for lines like:
PROBABLY_CAUSED_BY: nvlddmkm.sys
FAILURE_BUCKET_ID: 0x1E_nvlddmkm!unknown_function
The .sys filename tells you exactly which driver is responsible. Common culprits on Windows Server 2012 R2 include:
ntfs.sys— NTFS file system driver (disk controller or storage driver issues)ndis.sys/ NIC vendor drivers — Network adapter driver conflictsstorport.sys— Storage port miniport driver problems- Third-party antivirus kernel filters (e.g.,
mfehidk.sys,srtsp64.sys)
Step 2: Boot into Safe Mode
If the server BSODs on every boot, access Safe Mode to perform repairs:
For Windows Server 2012 R2:
- During boot, press F8 before the Windows logo appears.
- Select Safe Mode with Networking or Safe Mode with Command Prompt.
For Windows Server 2016/2019/2022 (F8 disabled by default): Run from an elevated command prompt before the next reboot:
bcdedit /set {default} safeboot minimal
After repairs, re-enable normal boot:
bcdedit /deletevalue {default} safeboot
Step 3: Run Driver Verifier to Isolate the Bad Driver
If the dump analysis is inconclusive, use Driver Verifier to stress-test all non-Microsoft drivers:
verifier /standard /all
Alternatively, target only third-party drivers:
verifier /standard /driver drivername1.sys drivername2.sys
Reboot the server. Driver Verifier will trigger an immediate BSOD when it detects any misbehaving driver, and the dump will now contain a precise identification. After you identify and fix the driver, disable Verifier:
verifier /reset
Warning: Do not leave Driver Verifier enabled on a production server for extended periods. It significantly impacts performance and may cause additional crashes. Use it in a maintenance window.
Step 4: Repair System Files
Corrupted system files are a primary cause of KMODE exceptions, especially after failed Windows Updates or ransomware activity.
Run System File Checker (SFC):
sfc /scannow
If SFC reports it cannot repair files, the component store itself may be corrupted. Run DISM first:
DISM on Windows Server 2012 R2 (requires internet or WSUS):
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
If the server has no internet access, use the installation media as a source:
DISM /Online /Cleanup-Image /RestoreHealth /Source:D:\sources\install.wim /LimitAccess
After DISM completes, run SFC again to verify all files are repaired:
sfc /scannow
Step 5: Update or Roll Back Drivers
Roll back a driver via PowerShell:
# List all third-party drivers
Get-WmiObject Win32_SystemDriver | Where-Object { $_.PathName -notlike '*system32*' } | Select-Object Name, PathName, State
# Roll back via Device Manager (GUI) or use PnPUtil to remove the driver package
pnputil /delete-driver oem15.inf /uninstall /force
Update network adapter drivers on Server 2012 R2:
pnputil /add-driver "C:\Drivers\NIC\nic_driver.inf" /install
Step 6: Test RAM with Windows Memory Diagnostic
Defective RAM produces seemingly random KMODE exceptions across many different drivers.
mdsched.exe
Select Restart now and check for problems. The tool runs before Windows loads and performs multiple passes. For a more thorough test, use MemTest86 from a bootable USB (memtest86.com), running at least 2 full passes (8+ hours recommended).
If RAM errors are found, reseat the DIMMs, swap slots, or replace the faulty module. On physical servers, check iDRAC/iLO/IPMI logs for memory ECC errors:
# Query Windows event log for memory errors
Get-WinEvent -LogName System | Where-Object { $_.Id -in @(1, 11, 52, 129, 157) } | Select-Object TimeCreated, Id, Message | Format-List
Step 7: Check for Windows Update Issues
On Windows Server 2019 and 2022, SYSTEM_SERVICE_EXCEPTION BSODs frequently follow Patch Tuesday updates. Uninstall the most recent update to test:
# List recently installed updates
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10
# Uninstall a specific update (replace KBxxxxxxx with the actual KB number)
wusa /uninstall /kb:5012345 /quiet /norestart
Step 8: Review Event Logs for Preceding Errors
The BSOD is rarely the first symptom. Look for warnings in the System and Application event logs in the minutes before the crash:
$crashTime = (Get-WinEvent -LogName System | Where-Object { $_.Id -eq 41 } | Select-Object -First 1).TimeCreated
Get-WinEvent -LogName System | Where-Object { $_.TimeCreated -gt $crashTime.AddMinutes(-10) -and $_.LevelDisplayName -in @('Error','Warning') } | Select-Object TimeCreated, Id, Message | Format-List
Event ID 41 (Kernel-Power) confirms an unexpected shutdown. Event IDs 11 and 15 in the System log indicate disk I/O errors that often precede storage-driver-related BSODs.
Frequently Asked Questions
# ============================================================
# Windows Server BSOD Diagnostic Script
# Covers: KMODE_EXCEPTION_NOT_HANDLED, CRITICAL_PROCESS_DIED,
# SYSTEM_SERVICE_EXCEPTION
# Run as Administrator
# ============================================================
# --- 1. Export recent crash events (Event ID 41 = unexpected shutdown) ---
Write-Host "[*] Checking for recent crash events..."
Get-WinEvent -LogName System -MaxEvents 500 | `
Where-Object { $_.Id -in @(41, 1001, 6008) } | `
Select-Object TimeCreated, Id, Message | `
Format-List | Out-File -FilePath "$env:TEMP\crash_events.txt"
Write-Host "[+] Crash events saved to $env:TEMP\crash_events.txt"
# --- 2. List all third-party (non-Microsoft) drivers ---
Write-Host "`n[*] Enumerating third-party drivers..."
Get-WmiObject Win32_SystemDriver | `
Where-Object { $_.PathName -notmatch 'system32\\drivers' -or $_.PathName -match 'oem|third' } | `
Select-Object Name, State, PathName | `
Format-Table -AutoSize
# Alternative: use driverquery for a full list with WHQL status
driverquery /v /fo csv | Out-File -FilePath "$env:TEMP\all_drivers.csv"
Write-Host "[+] Full driver list saved to $env:TEMP\all_drivers.csv"
# --- 3. Run System File Checker ---
Write-Host "`n[*] Running SFC scan (this may take 10-20 minutes)..."
sfc /scannow
# --- 4. Run DISM to repair the Windows image ---
Write-Host "`n[*] Running DISM health check and repair..."
DISM /Online /Cleanup-Image /CheckHealth
DISM /Online /Cleanup-Image /ScanHealth
DISM /Online /Cleanup-Image /RestoreHealth
# If no internet, mount the ISO and use:
# DISM /Online /Cleanup-Image /RestoreHealth /Source:D:\sources\install.wim /LimitAccess
# --- 5. Check for recent Windows Updates that may have caused the BSOD ---
Write-Host "`n[*] Recent Windows Updates (last 10):"
Get-HotFix | Sort-Object InstalledOn -Descending | Select-Object -First 10 | Format-Table -AutoSize
# --- 6. Enable Driver Verifier for all non-Microsoft drivers ---
# WARNING: Only run in a maintenance window. Will cause intentional BSODs.
# Uncomment the next line to enable:
# verifier /standard /all
# To check current verifier status:
verifier /querysettings
# To reset verifier after diagnosis:
# verifier /reset
# --- 7. Check RAM for errors via Windows event log ---
Write-Host "`n[*] Checking for hardware memory errors in event log..."
Get-WinEvent -LogName System -MaxEvents 1000 | `
Where-Object { $_.Id -in @(1, 11, 52, 129, 157, 1001) -and $_.ProviderName -match 'disk|hardware|whea' } | `
Select-Object TimeCreated, ProviderName, Id, Message | `
Format-List | Out-File -FilePath "$env:TEMP\hardware_errors.txt"
Write-Host "[+] Hardware error events saved to $env:TEMP\hardware_errors.txt"
# --- 8. Launch Windows Memory Diagnostic ---
Write-Host "`n[*] Scheduling Windows Memory Diagnostic on next reboot..."
# Uncomment to schedule:
# mdsched.exe
# --- 9. Find and display the most recent minidump file ---
Write-Host "`n[*] Locating most recent crash dump..."
$dumpPath = "$env:SystemRoot\Minidump"
if (Test-Path $dumpPath) {
$latestDump = Get-ChildItem $dumpPath -Filter "*.dmp" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
if ($latestDump) {
Write-Host "[+] Most recent minidump: $($latestDump.FullName) ($($latestDump.LastWriteTime))"
Write-Host " Analyze with: windbg -z $($latestDump.FullName)"
Write-Host " Then run: !analyze -v"
} else {
Write-Host "[-] No minidump files found in $dumpPath"
}
} else {
Write-Host "[-] Minidump directory not found. Enable small memory dumps in System Properties."
}
# --- 10. Export full system info for vendor support ---
Write-Host "`n[*] Collecting system information..."
Get-ComputerInfo | Out-File -FilePath "$env:TEMP\sysinfo.txt"
Write-Host "[+] System info saved to $env:TEMP\sysinfo.txt"
Write-Host "`n[DONE] Diagnostics complete. Review files in $env:TEMP"
Write-Host " Next steps: Analyze dump with WinDbg, update/rollback flagged drivers."Error Medic Editorial
The Error Medic Editorial team is composed of senior DevOps engineers, SREs, and Microsoft-certified infrastructure specialists with 10+ years of experience managing Windows Server environments across enterprise, cloud, and hybrid deployments. We specialize in translating complex system error diagnostics into actionable, production-safe remediation guides.
Sources
- https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x1e--kmode-exception-not-handled
- https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/driver-verifier
- https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/dism
- https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg
- https://support.microsoft.com/en-us/topic/use-the-system-file-checker-tool-to-repair-missing-or-corrupted-system-files-79aa86cb-ca52-166a-92a3-966e85d4094e
- https://stackoverflow.com/questions/tagged/windows-server+bsod