Windows Commands / IT Support Guides
Read recent Windows errors with Get-WinEvent
Find recent errors in the Windows System event log and match them to the time a problem began.
Environment and inputs: Windows 11 · Command Prompt unless PowerShell is specified
Understand the problem
Run PowerShell on the affected Windows computer. Note the time the problem started and check that your account can read the System log.
Run the command
The displayed command selects Error events (Level 2) from the last two hours and returns up to 20. Change the time window if the problem happened earlier.
Get-WinEvent -FilterHashtable @{LogName='System'; Level=2; StartTime=(Get-Date).AddHours(-2)} -MaxEvents 20 | Select-Object TimeCreated, Id, ProviderName, Message
Read the output
Start with TimeCreated and ProviderName. An event ID has meaning in the context of its provider, so record both. Read Message for the details of that occurrence.
Choose the next step
If no entries match, confirm the time window and log name. An application may write to the Application log or to its own log. A warning or critical event can also fall outside this filter.
Before making changes
Keep the timestamp, provider and event ID when sharing a finding. Review the message for sensitive values before sending it.