Sorry to ask such a question, but I've spent 1/2 hour on this and no good solution.
I want to get the latest date from the Event Log for a particular app. So far, my code is:
$event = get-eventlog -logname 'Windows PowerShell' -source mpkLogParser -newest 1 | Format-List
echo $event
this yields:
Index : 51
EntryType : Information
InstanceId : 3001
Message : MPKLogParser successfully parsed the log file u_ex100118.log
Category : (1)
CategoryNumber : 1
ReplacementStrings : {MPKLogParser successfully parsed the log file u_ex100118.log}
Source : mpkLogParser
TimeGenerated : 1/28/2010 11:24:08 AM
TimeWritten : 1/28/2010 11:24:08 AM
UserName :
So how do I extract the TimeWritten part from $event?
Any help with this and I can sleep better. :)