Created
January 2, 2026 17:14
-
-
Save hyperreality/f88b2674324387a498c5f20361ad2085 to your computer and use it in GitHub Desktop.
Get Windows reboot reason
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $today = Get-Date | |
| $startDay = $today.AddDays(-5) | |
| $eventIds=(6005,6006,6008,6009,1074,1076,12,13,43,109) | |
| $systEvents=Get-WinEvent -LogName System | |
| $rebootEvents=$systEvents| Where-Object {$_.TimeCreated -gt $startDay} | Where-Object {$_.Id -in $eventIds} | |
| format-table TimeCreated,Id,Message -AutoSize -wrap -InputObject $rebootEvents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment