Get-EventLog - easy to filter today?

I want to quickly check the events that happened today (that is: anything from midnight onwards); is there a β€œtoday” alias / built in to Powershell to help with this?

I am currently doing something like this:

get-eventlog system  -source "disk" -after ([datetime] '01/01/2015')

But of course I have to change the date string.

[Also: does this datetime constructor seem to insist only on the date format in the US (mm / dd / yyyy) - even though my Windows Locale is UK?]

+4
source share
1 answer

The DateTime class has a static property Todaythat will return exactly what you need:

get-eventlog system  -source "disk" -after ([datetime]::Today)
+5
source

All Articles