Get-WinEvent PowerShell cmdlet Cheat Sheet
Abstract
Where to Acquire
PowerShell is natively installed in Windows Vista and newer, and includes the Get-WinEvent cmdlet by default.
Examples/Use Case
Get-WinEvent
View all events in the live system Event Log:
PS C:\> Get-WinEvent -LogName system
View all events in the live security Event Log (requires administrator PowerShell):
PS C:\> Get-WinEvent -LogName security
PS C:\> Get-WinEvent -Path example.evtx | fl
PS C:\> Get-WinEvent -Path example.evtx | Out-GridView
PS C:\> Get-WinEvent -Path example.evtx | Group-Object id -NoElement | sort count
PS C:\> Get-WinEvent -FilterHashtable @{Path="system.evtx"; ID=7030,7045}
PS C:\> Get-WinEvent -FilterHashtable @{logname="system"; id=7030,7045}
PS C:\> Get-WinEvent -FilterHashtable @{Path="system.evtx"} | Where {$_.Message -like "*USB*"}
PS C:\> Get-WinEvent -FilterHashtable @{Path="system.evtx"} | fl | findstr /i USB
PS C:\> Get-WinEvent -FilterHashtable @{Path="application.evtx"; level=2}
PS C:\> Get-WinEvent -FilterHashtable @{Path="application.evtx"; level=2} | Measure-Object -Line
AppLocker
Pull all AppLocker logs from the live AppLocker event log (requires Applocker):
PS C:\> Get-WinEvent -logname "Microsoft-Windows-AppLocker/EXE and DLL"
PS C:\> Get-WinEvent -FilterHashtable @{logname="Microsoft-Windows-Applocker/EXE and DLL"; id=8004}
PS C:\> Get-WinEvent -FilterHashtable @{logname="Microsoft-Windows-Applocker/EXE and DLL"; id=8003}
EMET
Pull all EMET logs from the live Application Event log (requires EMET):
PS C:\> Get-WinEvent -FilterHashtable @{logname="application"; providername="EMET"}
```
Pull all EMET logs from a saved Application Event log (requires EMET):
```powershell
PS C:\> Get-WinEvent -FilterHashtable @{path="application.evtx"; providername="EMET"}
Sysmon
Pull all Sysmon logs from the live Sysmon Event log (requires Sysmon and an admin PowerShell):
PS C:\> Get-WinEvent -LogName "Microsoft-Windows-Sysmon/Operational"
PS C:\> Get-WinEvent -FilterHashtable @{logname="Microsoft-Windows-Sysmon/Operational"; id=1}
Windows Defender
Pull all live Windows Defender event logs
PS C:\> Get-WinEvent -FilterHashtable @{logname="Microsoft-Windows-Windows Defender/Operational"}
PS C:\> Get-WinEvent -FilterHashtable @{logname="Microsoft-Windows-Windows Defender/Operational";id=1116,1117}
PS C:\> Get-WinEvent -FilterHashtable @{path="WindowsDefender.evtx";id=1116,1117}
A printable PDF version of this cheatsheet is available here: Get-WinEvent