Search code examples
windowspowershellbluetoothnetsh

How to list bluetooth devices near me using PowerShell


How to list all Bluetooth devices paired or currently near me and particullary MAC adress ? I want the equivalent of the command :

netsh wlan show network mode=bssid

I am able to list all Bluetooth devices and characteristics but not MAC adress with the command :

Get-PnpDevice | Where-Object {$_.Class -eq "Bluetooth"}
foreach ($device in $devices) { echo $device.InstanceId }

Note it is not a problem if I need to manually shrink results and if the list is not in a perfect layout.


Solution

  • The PowerShell command :

    Get-ChildItem -Path HKLM:\SYSTEM\ControlSet001\Services\DeviceAssociationService\State\Store\ | Select-String -Pattern Bluetooth
    

    will print devices already paired :

    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DeviceAssociationService\State\Store\Bluetooth#BluetoothXX:XX:XX:XX:XX:b2-YY:YY:YY:YY:YY:YY
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DeviceAssociationService\State\Store\Bluetooth#BluetoothXX:XX:XX:XX:XX:b2-ZZ:ZZ:ZZ:ZZ:ZZ:ZZ
    HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\DeviceAssociationService\State\Store\BluetoothLE#BluetoothLEXX:XX:XX:XX:XX:b2-WW:WW:WW:WW:WW:WW
    

    The XX:XX:XX:XX:XX values is your Bluetooth MAC adress.