Get-Eventog
Jump to navigation
Jump to search
get-eventlog -list
get-eventlog system -new 10 | Select-Object -Property *
#Search for All Event Log(Require Administrator previlage)
Get-EventLogError -FilterLevel Warning -FromLastBootupTime | Format-Table -AutoSize
#Search for Windows PowerShell Logs
Get-EventLogError -LogName "*PowerShell*" -FilterLevel Warning -FromLastBootupTime | Format-Table -AutoSize
#Search for Application/System Log
Get-EventLogError -LogName @("Application","System") -FilterLevel Warning -FromLastBootupTime | Format-Table -AutoSize
#Specify Range
$from = (Get-Date).AddHours(-20)
$to = (Get-Date)
Get-EventLogError -LogName @("Application","System") -FilterLevel Warning -From $from -To $to | Format-Table -AutoSize
#Add new entry to EventLog
Write-EventLog -LogName Application -Source Application -Message "Test" -EventId 0 -EntryType information
#Get EventLog entry added after last query execution
Get-EventLogError -LogName "Application" -FilterLevel Infomational -FromLastQueryTime | Format-Table -AutoSize