$eventlogs = "Application", "Security", "System"
$lognames = $eventlogs | ForEach-Object {$_ + ".evtx"}
$path = "C:\EventLogs\"
$date = (Get-Date).AddDays(-30)
foreach ($logname in $lognames) {
$log = Get-WinEvent -LogName $logname -FilterXPath "*[System[TimeCreated[@SystemTime>='$date']]]"
$log | Export-EventLog -Path "$path$logname"
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter