I want to quickly check for events that happened today (that is: anything from midnight onwards); is there 'today' alias/built-in in Powershell to help out with this ?
I'm currently doing something like this:
get-eventlog system -source "disk" -after ([datetime] '01/01/2015')
But of course I keep having to change the date string.
[ Also: that datetime constructor appears to insist on a US date-format (mm/dd/yyyy) only - despite the fact that my Windows Locale is UK ?]
The DateTime class has a static Property Today
which will return exactly what you need:
get-eventlog system -source "disk" -after ([datetime]::Today)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With