Created
February 13, 2023 10:20
-
-
Save nikvoronin/e8fc8a1631dd0e851f1ab821d0e3cf01 to your computer and use it in GitHub Desktop.
Query battery level for WH-1000XM4 wireless headphones
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
# https://stackoverflow.com/a/75174377 | |
Get-PnpDevice -FriendlyName "*WH-1000XM4*" | ForEach-Object { | |
$local:test = $_ | | |
Get-PnpDeviceProperty -KeyName '{104EA319-6EE2-4701-BD47-8DDBF425BBE5} 2' | | |
Where Type -ne Empty; | |
if ($test) { | |
"To query battery for $($_.FriendlyName), run the following:" | |
" Get-PnpDeviceProperty -InstanceId '$($test.InstanceId)' -KeyName '{104EA319-6EE2-4701-BD47-8DDBF425BBE5} 2' | % Data" | |
"" | |
"The result will look like this:"; | |
Get-PnpDeviceProperty -InstanceId $($test.InstanceId) -KeyName '{104EA319-6EE2-4701-BD47-8DDBF425BBE5} 2' | % Data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment