PowerShell - Find Bluetooth Device Connectivity Status

4.4k Views Asked by At

How can I find the value of "is connected" for a Bluetooth device? I've tried Get-WMIObject cmdlets and a few others but none of the values changed when I connect/disconnect. The only place I have found the value to change is in the attached image. I found it in the Device Properties for the Bluetooth Headset I am trying to use.

I'm trying to write a toggle script for AutoHotKey to send btcom commands, but I would like to write an if statement with that. The piece I'm missing here is finding the value of "is connected" on my Bluetooth device.

Example of output from Get-WMIObject:

PS H:\> Get-WmiObject -Query "select * from win32_PnPEntity where Caption='Jordan's AirPods Pro'"


__GENUS                     : 2
__CLASS                     : Win32_PnPEntity
__SUPERCLASS                : CIM_LogicalDevice
__DYNASTY                   : CIM_ManagedSystemElement
__RELPATH                   : Win32_PnPEntity.DeviceID="BTHENUM\\DEV_14C88BC438FE\\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE"
__PROPERTY_COUNT            : 26
__DERIVATION                : {CIM_LogicalDevice, CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER                    : OL-2TK93103QK
__NAMESPACE                 : root\cimv2
__PATH                      : \\OL-2TK93103QK\root\cimv2:Win32_PnPEntity.DeviceID="BTHENUM\\DEV_14C88BC438FE\\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE"
Availability                :
Caption                     : Jordan’s AirPods Pro
ClassGuid                   : {e0cbf06c-cd8b-4647-bb8a-263b43f0f974}
CompatibleID                : {BTHENUM\GENERIC_DEVICE}
ConfigManagerErrorCode      : 0
ConfigManagerUserConfig     : False
CreationClassName           : Win32_PnPEntity
Description                 : Bluetooth Device
DeviceID                    : BTHENUM\DEV_14C88BC438FE\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE
ErrorCleared                :
ErrorDescription            :
HardwareID                  : {BTHENUM\Dev_14C88BC438FE}
InstallDate                 :
LastErrorCode               :
Manufacturer                : Microsoft
Name                        : Jordan’s AirPods Pro
PNPClass                    : Bluetooth
PNPDeviceID                 : BTHENUM\DEV_14C88BC438FE\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE
PowerManagementCapabilities :
PowerManagementSupported    :
Present                     : True
Service                     :
Status                      : OK
StatusInfo                  :
SystemCreationClassName     : Win32_ComputerSystem
SystemName                  : OL-2TK93103QK
PSComputerName              : OL-2TK93103QK



PS H:\>
0

There are 0 best solutions below