Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Powershell date filtering

$
0
0

I'm trying to return 1221 events that were produced today:

Get-EventLog "Application" | where-Object {$_.EventID -eq 1221 -AND $_.lastwritetime -eq [datetime]::today} | Format-Table -autosize -wrap

This produces nothing. If I substitute "-eq [datetime]::today" with "-lt [datetime]::today" I get events from today and earlier, but I don't want earlier...

What am I doing wrong?


Viewing all articles
Browse latest Browse all 15370

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>