Skip to content

Instantly share code, notes, and snippets.

@yordanoweb
Last active March 13, 2025 18:49
Show Gist options
  • Save yordanoweb/dd62cfb609c864d55ff1a6a0f42d386c to your computer and use it in GitHub Desktop.
Save yordanoweb/dd62cfb609c864d55ff1a6a0f42d386c to your computer and use it in GitHub Desktop.
Get latest Windows reboot reasons

List latest Windows reboots and its causes

$rebootEvents = Get-WinEvent -FilterHashtable @{
    LogName = 'System'
    ID = 1074, 6008
} -MaxEvents 10 | Sort-Object TimeCreated -Descending

$rebootEvents | ForEach-Object {
    $event = $_
    [PSCustomObject]@{
        TimeCreated = $event.TimeCreated
        EventID     = $event.Id
        Message     = $event.Message
    }
} | Format-List *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment