Get-Eventog

From UVOO Tech Wiki
Revision as of 19:05, 29 January 2021 by Busk (talk | contribs) (Created page with "``` #Search for All Event Log(Require Administrator previlage) Get-EventLogError -FilterLevel Warning -FromLastBootupTime | Format-Table -AutoSize #Search for Windows PowerS...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
#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