Skip to content

Instantly share code, notes, and snippets.

@kurtraschke kurtraschke/sleep.ps1
Last active Mar 2, 2016

What would you like to do?
PowerShell script to summarize a Windows PC's sleep history
$filter = @{LogName='System';
$namespaces = @{"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
} | Out-GridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.