Analyzing Windows event logs is one of the daily tasks of most IT administrators. And especially if you have more number of servers in your ownership, filtering the relevant events using PowerShell will save a lot of time.
Here I am showing an example of filtering errors from System logs of last 24 hours.
Get all system event logs: Get-eventlog -LogName System
Filtering error events: Get-eventlog -LogName System -EntryType Error
Filtering again to last 24 hours: Get-eventlog -LogName System -EntryType Error -After (Get-Date).AddDays(-1)
Now you may want to select the event id, time generated and corresponding message and then write it to a html file.
Get-eventlog -LogName System -EntryType Error -After (Get-Date).AddDays(-1) | select EventID, TimeGenerated, Message | convertto-html | Out-File C:\errorlist.htm
Reference: Get-Help Get-eventlog -ShowWindow