Skip to content

Instantly share code, notes, and snippets.

@nikvoronin
Created February 13, 2023 10:20
Show Gist options
  • Save nikvoronin/e8fc8a1631dd0e851f1ab821d0e3cf01 to your computer and use it in GitHub Desktop.
Save nikvoronin/e8fc8a1631dd0e851f1ab821d0e3cf01 to your computer and use it in GitHub Desktop.
Query battery level for WH-1000XM4 wireless headphones
# 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