7

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.

Yoan
  • 75
  • 1
  • 5

2 Answers2

4

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.

Anonymous
  • 468
  • 5
  • 26
0

Use registry subkeys from Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Devices:

$devices = Get-ChildItem -Path HKLM:\SYSTEM\ControlSet001\Services\BTHPORT\Parameters\Devices
foreach($device in $devices) {
    $address=$device.pschildname.ToUpper()
    $name=$device.GetValue("Name")
    if($name -ne $null) {
        $printableName = ($name -notmatch 0 | ForEach{[char]$_}) -join ""
        echo "Address: $address, Name: $printableName"
    }
}
daniol
  • 115
  • 7