Why Did My Windows PC Restart or Crash? Find the Answer in Event Viewer and PowerShell

Troubleshooting 8 min readUpdated Nov 17, 2026
1 view0 comments
A desk with an ultrawide monitor and purple ambient lighting
Photo: Redd Angelo reddangelo16 / Wikimedia Commons (CC0, public domain). source

Your Windows PC restarted on its own, or froze and then rebooted, and you want to know why. Windows records the answer. You do not need extra software: the Event Viewer and a few PowerShell commands tell you whether the restart was planned (an update), a crash (a blue screen), or an unexpected power loss. This guide shows which events to look for, how to read them, and what to try for each cause. The commands were run on Windows 11 with Windows PowerShell 5.1, and they work in PowerShell 7 too.

The six events that matter

All of these are in the System log. Learn the numbers, because the text of the messages changes with your Windows display language but the event IDs do not.

Event ID Source What it means
41 Kernel-Power “The system has rebooted without cleanly shutting down first.” Windows was not shut down properly: a crash, a freeze, a power cut, or a long press of the power button.
6008 EventLog “The previous system shutdown at (time) was unexpected.” It tells you when the last session ended.
1074 User32 A program or user asked for a restart or shutdown on purpose: Windows Update, Start menu, a script. It names the process and the reason.
6005 EventLog “The Event log service was started.” This marks a boot.
6006 EventLog “The Event log service was stopped.” This marks a clean shutdown.
1001 WER-SystemErrorReporting “The computer has rebooted from a bugcheck.” A blue screen (BSOD) happened, and the stop code is included.

A healthy restart leaves a tidy pair: 1074 (someone asked) followed by 6006 (clean stop) and, after boot, 6005. A restart that nobody asked for leaves 41 and 6008 instead, with no 6006 before it.

Step 1: How long has the PC been running?

(Get-CimInstance Win32_OperatingSystem).LastBootUpTime
(Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

The first line shows when it last booted, and the second shows the uptime. If you thought the PC had been on for a week and it says 40 minutes, it restarted without telling you. In Command Prompt, systeminfo prints the same boot time.

Step 2: List the restart events from the last 30 days

Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,1074,6005,6006,6008; StartTime=(Get-Date).AddDays(-30)} -ErrorAction SilentlyContinue |
  Select-Object TimeCreated, Id, ProviderName |
  Format-Table -AutoSize
TimeCreated           Id ProviderName
-----------           -- ------------
12/11/2026 21:49:32   41 Microsoft-Windows-Kernel-Power
12/11/2026 21:49:46 6005 EventLog
12/11/2026 21:49:46 6008 EventLog
11/11/2026 13:37:34 6005 EventLog
11/11/2026 13:36:51 6006 EventLog
11/11/2026 13:35:32 1074 User32

Read it from the bottom up, because the newest event is at the top. The last three lines are a normal restart: 1074 (asked), 6006 (clean stop), 6005 (boot). The top three are an unplanned one: Event 41 and 6008 with no 6006 before the boot. -ErrorAction SilentlyContinue hides the “no events found” message when a log is clean.

To count how many of each there were:

Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,1074,6005,6006,6008; StartTime=(Get-Date).AddDays(-30)} -ErrorAction SilentlyContinue |
  Group-Object Id | Sort-Object Name | Select-Object Name, Count

Several Event 41s in a month is a pattern worth chasing. One in a year can be a power cut.

Step 3: Was it a crash or a power loss? Read Event 41

Event 41 holds the clue in its details. This reads them:

$e = Get-WinEvent -FilterHashtable @{LogName='System'; Id=41} -MaxEvents 1
([xml]$e.ToXml()).Event.EventData.Data | Select-Object Name, '#text'
Name                 #text
----                 -----
BugcheckCode         0
BugcheckParameter1   0x0
SleepInProgress      0
PowerButtonTimestamp 0
...
Field What it tells you
BugcheckCode 0: Windows did not blue-screen. It stopped suddenly, as with a power cut, a hard freeze, a forced power-off or a hardware reset. Not 0: a blue screen. The number is the stop code (in decimal; convert it to hex to look it up).
PowerButtonTimestamp Not 0 means the power button was pressed to force the PC off, so you (or someone) held the button because it was frozen.
SleepInProgress Not 0 means the crash happened while going to sleep or waking up. That points to a driver or power setting.

A BugcheckCode of 0 repeated several times is the signature of power or hardware trouble, not software.

Step 4: What happened just before it?

Look at the events in the few minutes before the restart. Here, the three minutes before the last Event 41:

$e = Get-WinEvent -FilterHashtable @{LogName='System'; Id=41} -MaxEvents 1
Get-WinEvent -FilterHashtable @{LogName='System'; StartTime=$e.TimeCreated.AddMinutes(-3); EndTime=$e.TimeCreated} -ErrorAction SilentlyContinue |
  Sort-Object TimeCreated |
  Select-Object -Last 8 TimeCreated, Id, LevelDisplayName, ProviderName

Watch for warnings or errors from disk (disk, Ntfs), graphics or other drivers, or Kernel-Power itself. A gap with no events at all can mean the PC froze: the log simply stopped being written, then resumed after the hard reset. For example, a 6008 that says the previous shutdown was at 21:32 while the next boot was at 21:49 suggests the PC was frozen or off for about 17 minutes before it was reset.

To list recent errors and critical events from the whole System log:

Get-WinEvent -FilterHashtable @{LogName='System'; Level=1,2; StartTime=(Get-Date).AddDays(-7)} -MaxEvents 20 |
  Select-Object TimeCreated, Id, ProviderName

Get-WinEvent -FilterHashtable @{LogName='System'; Level=1,2; StartTime=(Get-Date).AddDays(-7)} -ErrorAction SilentlyContinue |
  Group-Object ProviderName | Sort-Object Count -Descending | Select-Object -First 5 Name, Count

Level 1 is Critical and level 2 is Error. The second command groups the errors by provider, which shows which component complains most. Do not panic over a few errors, because every healthy Windows PC logs some. Look for the ones that cluster just before the restarts.

Step 5: Was it a planned restart? Read Event 1074

Get-WinEvent -FilterHashtable @{LogName='System'; Id=1074; StartTime=(Get-Date).AddDays(-30)} |
  Select-Object TimeCreated, Message | Format-List

The message names the process that asked for the restart, the user, and the reason. For example: “The process (path to a program) has initiated the restart of computer (name) on behalf of user (user) for the following reason: Operating System: Upgrade (Planned)”. If you see TrustedInstaller.exe or MoUsoCoreWorker.exe, it was Windows Update. If you see a program you do not recognise, find out what it is. A reason of Other (Unplanned) with the Start menu host as the process usually just means someone chose Restart.

Step 6: The Reliability Monitor, a friendlier view

Press Win+R, type perfmon /rel and press Enter. The Reliability Monitor shows a day-by-day timeline with a stability score from 1 to 10, and red markers for Windows failures, application failures and app hangs. Click a day to see the details. It reads the same event log, but groups the information so it is easy to spot the day things went wrong and what was installed just before.

You can also pull the same records into PowerShell:

Get-CimInstance Win32_ReliabilityRecords |
  Where-Object TimeGenerated -gt (Get-Date).AddDays(-30) |
  Group-Object SourceName | Sort-Object Count -Descending | Select-Object -First 5 Name, Count

Step 7: Look for crash dump files

When Windows blue-screens it can save a memory dump:

Test-Path C:\Windows\Minidump
Test-Path C:\Windows\MEMORY.DMP
Get-ChildItem C:\Windows\Minidump -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -First 5 Name, Length, LastWriteTime

A .dmp file in C:\Windows\Minidump means a blue screen was captured. You can open it with Microsoft’s free WinDbg debugger (from the Microsoft Store) and run !analyze -v to see which driver was involved. If there are no dump files and Event 41 shows a BugcheckCode of 0, it was not a blue screen.

What to do for each cause

What you found Likely cause What to try
Event 41, BugcheckCode 0, no dump, nothing before it Power loss, power supply, battery, overheating, or a hardware freeze Check the power cable, outlet and any power strip. On a laptop, check the battery health. Clean the dust from the vents. Watch temperatures. Try another power supply.
Event 41 with a BugcheckCode and a dump file A blue screen, most often a driver Note the stop code, update or roll back the display, network and storage drivers, and uninstall recent software.
Event 41 with SleepInProgress not 0 Crash during sleep or wake Update the chipset and graphics drivers and the BIOS. Test with sleep turned off.
Disk or Ntfs errors before the restart Failing disk or file-system damage Back up first. Run chkdsk C: /scan and check the drive’s SMART health.
Crashes that cluster with heavy use Faulty memory or overheating Run mdsched.exe (Windows Memory Diagnostic) and check the temperatures.
1074 from the update service A planned update restart Normal. Set Active hours so it does not restart while you work. If updates keep failing, see how to fix Windows Update errors with SFC and DISM.

Corrupted Windows files can also cause crashes. sfc /scannow followed by DISM /Online /Cleanup-Image /RestoreHealth repairs them, as explained in the guide linked above.

A note on a few things that confuse people

  • Fast Startup. On many PCs, “Shut down” does not fully power off but saves part of the session to disk. A real restart clears this, so if the PC acts strangely, choose Restart rather than shut down and turn on.
  • Event text language. The message is translated, but the IDs, the property names (BugcheckCode) and the providers are the same in every language. Search by ID.
  • Permissions. Reading the System log works for a normal user on most PCs. On locked-down work PCs you may need to open PowerShell as administrator.
  • Save the evidence. To keep a copy of the log for a support ticket, run wevtutil epl System C:\Temp\system.evtx, which writes the log to a file.

Quick reference

# Boot time and uptime
(Get-CimInstance Win32_OperatingSystem).LastBootUpTime

# All restart-related events from the last 30 days
Get-WinEvent -FilterHashtable @{LogName='System'; Id=41,1074,6005,6006,6008; StartTime=(Get-Date).AddDays(-30)} -ErrorAction SilentlyContinue |
  Select-Object TimeCreated, Id, ProviderName

# Was it a blue screen? (BugcheckCode not 0)
$e = Get-WinEvent -FilterHashtable @{LogName='System'; Id=41} -MaxEvents 1
([xml]$e.ToXml()).Event.EventData.Data | Select-Object Name, '#text'

# Friendly timeline
perfmon /rel

To learn more about the commands used here, read our PowerShell one-liners and the complete PowerShell guide.

Did you find this helpful?Tap the heart to let us know. It takes one second and no account.

More tutorials like this

Leave a Comment

Your email address will not be published. Required fields are marked *

Bigland Network IT

Practical tutorials for people who run, build and fix things: operating systems, databases, development, networking and security.

Topics

More

Site

© 2026 Bigland Network. All rights reserved.Always test commands on a non-production system first.
Scroll to Top