Good day.
I’m trying to filter logs with get-winevent. When I working with local logs as security, system etc. all is ok. StartTime work correctly.
$yesterday = (get-date) - (new-timespan -day 1)
$a = get-winevent -FilterHashTable @{LogName='system'; StartTime=$yesterday}
When I try to use this command with “forwarded events” there is error: “Get-WinEvent : No events were found that match the specified selection criteria.” Problem with “StartTime” and “EndTime” only.
Anyone knew where is the problem?
For these types of logs you need to use an xpath query, which is complicated.
I don’t have anything in ForwardedEvents so I used a different log. The best thing to do is use EventViewer to build your query then copy and paste the XML. You’ll most likely need to fiddle with quote characters.