How to export all System event logs of a definite time period
15,664
Modify your Get-WinEvent
with a filter.
$startTime = get-date "5/22/2012 20:00:00"
$endTime = get-date "5/23/2012 11:00:00"
Get-WinEvent -FilterHashtable @{Logname="System"; StartTime=$startTime; EndTime=$endTime} | Export-CSV -Path c:\temp\output.csv
Related videos on Youtube
Author by
whizkid
Sysadmin, Virtualization enthusiast, Technut, trying to blog as regularly as I can!
Updated on September 18, 2022Comments
-
whizkid over 1 year
I am working on a Windows Server 2003 SP2 with Powershell v2, and I am looking for a way to export all System event logs of a definite time period, (say, from Saturday 2000 hours to Sunday 1100 hours).
I can export all existing System logs using Get-Eventlog command to a CSV file, then copy the entries in the said time window. Though, I am looking an easier way to do this with or without using powershell.