Created
April 7, 2024 12:25
-
-
Save sub314xxl/59af788fe636ba026dfeba7aaf1ca11a to your computer and use it in GitHub Desktop.
PoSH: get boot process duration
This file contains 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
Get-WinEvent -FilterHashtable @{LogName="Microsoft-Windows-Diagnostics-Performance/Operational"; Id=100} -MaxEvents 10 | ForEach-Object { | |
# convert the event to XML and grab the Event node | |
$eventXml = ([xml]$_.ToXml()).Event | |
# output | |
[PSCustomObject]@{ | |
'Computer' = $eventXml.System.Computer | |
'BootTime' = [int64]($eventXml.EventData.Data | Where-Object {$_.Name -eq 'BootTime'}).InnerXml | |
'BootFinished' = [datetime]($eventXml.EventData.Data | Where-Object {$_.Name -eq 'BootEndTime'}).InnerXml | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment