> ## Content Index
> Fetch the complete content index at: https://www.filipkonopik.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# PowerShell: Find Events by Time Range
- URL: https://www.filipkonopik.com/powershell-find-events-by-time-range/
- Published: 2026-07-27T10:48:28.000Z
- Updated: 2026-08-06T05:45:24.000Z
- Author: Filip Konopík
- Tags: Event Logs & Monitoring

Need to check what happened during a specific window of time - narrowing down when an issue started, or reviewing activity from a particular day? This one-liner filters events between two timestamps.

Prerequisites:

- Privileges: None (for System and Application logs; Security log requires Administrator)
- Module: Built-in, no import needed

Quick Command:

```powershell
Get-WinEvent -FilterHashtable @{LogName='System'; StartTime=(Get-Date).AddDays(-1); EndTime=(Get-Date)} -MaxEvents 5
```

Example Output:

```powershell
ProviderName: Microsoft-Windows-DistributedCOM
TimeCreated                     Id LevelDisplayName Message
-----------                     -- ---------------- -------
7/27/2026 12:44:20 PM         10016 Warning         The machine-default permission settings do not grant Local...
7/27/2026 12:44:20 PM         10016 Warning         The application-specific permission settings do not grant...
```

📦

****Want all of them at once?**  
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.

[Get the Complete Bundle for $39](https://gum.co/u/oczvkqdc?ref=filipkonopik.com)

How It Works:

- StartTime=(Get-Date).AddDays(-1) sets the beginning of the time window to exactly 24 hours before right now - (Get-Date) gets the current date and time, and .AddDays(-1) subtracts one full day from it.
- EndTime=(Get-Date) sets the end of the window to the current moment - together with StartTime, this creates a rolling "last 24 hours" filter.
- \-MaxEvents 5 limits the output to the most recent matches within that time window.