IT Toolbox
Menu
PowerShell · Logs

Find critical errors from the last 24 hours

Extracts error and critical events from the System and Application logs for the last 24 hours.

Low riskAdministrator rights may be required

Command

$Depuis = (Get-Date).AddHours(-24) Get-WinEvent -FilterHashtable @{ LogName = @('System','Application') Level = 1,2 StartTime = $Depuis } -ErrorAction SilentlyContinue | Select-Object TimeCreated, LogName, Id, ProviderName, LevelDisplayName, Message | Sort-Object TimeCreated -Descending | Format-List

When to use it

Run this after a crash, unexpected restart, or application failure.

How it works

  • Levels 1 and 2 correspond to critical events and errors.
  • Change AddHours(-24) to adjust the time window.

Precautions

  • Event logs may contain errors with no real impact; always correlate the timestamp with the reported symptom.

Rollback

Read-only operation; no rollback is required.

Support the development of BAOI Hosting, domains and new IT resources.
❤️ Support BAOI