Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Put PnP device ids into a hashtable (dictionary) for fast lookup of friendly names
- [hashtable]$devices=@{} ; Get-PnpDevice|ForEach-Object{ $devices.Add( $_.InstanceId , $_.FriendlyName ) }
- Get-CimInstance -ClassName MSPower_DeviceEnable -Namespace root\wmi | Select-Object -Property @{name='FriendlyName';expression={$devices[ $_.InstanceName -replace '_\d+$' ]}}, Active,Enable,InstanceName | Sort-Object -Property FriendlyName
- ## Optionally change Power Management state by changing "Enable" property of the object(s) returned from Get-CimInstance and pipe through Set-CimInstance
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement