Command Reference

Get-WinEvent

PowerShell Diagnostics Intermediate Risk: Low
Back to Command Library

Summary

Reads structured events from Windows logs to gather crash and system evidence.

Syntax

Get-WinEvent [-FilterHashtable <Hashtable>] [-MaxEvents <Int64>]

Examples

Get-WinEvent -FilterHashtable @{LogName='Application'; Level=2; StartTime=(Get-Date).AddDays(-1)} -MaxEvents 20

Shows up to 20 application errors from the last day.

Permissions

Administrator required: No

Some logs require an elevated PowerShell session.

Risk and Impact

Risk level: Low

Changes the system: No

Event details may contain usernames, device names, or file paths; review before sharing.

Supported Platforms

Windows 10 Windows 11 Windows Server

Important Output Fields

TimeCreated

When Windows recorded the event.

Id

Provider-specific event identifier.

Message

Detailed event description.

Common Errors

No events were found

No events matched the selected log, time, and severity filters.

Access is denied

The selected log requires elevated access.

Official References

Get-WinEvent

Microsoft Learn · Official Documentation

Open Source