Last active
March 2, 2016 02:48
-
-
Save kurtraschke/16bb99be890623c50b7f to your computer and use it in GitHub Desktop.
PowerShell script to summarize a Windows PC's sleep history
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
$filter = @{LogName='System'; | |
ProviderName='Microsoft-Windows-Power-Troubleshooter'; | |
ID=1} | |
$namespaces = @{"event"="http://schemas.microsoft.com/win/2004/08/events/event"} | |
Get-WinEvent -FilterHashtable $filter | % { | |
$obj = New-Object PSObject | |
[xml]$_.ToXml() | Select-Xml -Namespace $namespaces "/event:Event/event:EventData/event:Data" | % { | |
Add-Member -InputObject $obj -MemberType NoteProperty -Name $_.Node.Name -Value $_.Node.'#text' | |
} | |
Add-Member -InputObject $obj -MemberType NoteProperty -Name "Message" -Value $_.Message | |
$obj | |
} | Out-GridView |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment