Reputation: 75
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.
Upvotes: 7
Views: 14576
Reputation: 113
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"
}
}
Upvotes: 0
Reputation: 456
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.
Upvotes: 3