I am trying to query application event log for a certain time period in order to check a specific event which confirms the backup status of an application. Since the backup schedule is set between 10:00 PM and 11:00 PM, I am trying to get info about event id 18264.
I use:
gwmi -computername somename -namespace root\cimv2 -query "Select EventCode from Win32_NTLogEvent where LogFile = 'Application' and EventCode = '18264'"
Now, what happens is that I get more than one output. I want to limit the output to 1 which is based on the latest. Example; get event id for yesterday between 10 PM and 11 PM. I see a column as TimeWritten. Can someone please help? Thanks!