Show all currently connected Bluetooth devices

HI There,

on my Laptop I am using
a) the build-in keyboard with German Keyboard layout
b) a bluetooth connected keyboard with Swiss-german keyboard layout

I am using them mutual exclusive.

I want to use a powershell scripts that checks if my Bluetooth keyboard is connected and then switch to swiss-german layout and if not, set windows to german layout.

Both regional keyboard layout setting and layouts are installed on my Windows 11 with Powershell 7.4.2

I tried Get-PnPDevice which goes in the right direction but has strange behaviour.
It shows me devices as STATUS=OK although they are not currently connected to Windows.
Also the attribute “Availability” nor “PresentOnly” seems to help.

Does anybody have an idea/advice?

Have you explored WMI/CIM at all for this? I’m not at a computer right now but I found this

and it seems like maybe it could provide different results than what you’re getting with Get-PnPDevice

Hi greyout,

thanks for the swift reply. Unfortunately, the PowerShell script linked above gives me similar results than PnPDevice. Meaning it shows devices as connected which are currently (for sure) not connected.
I have the feeling by “connected” the system means in fact “coupled” and this is not what I want.

So all devices that are “coupled” AND “connected_currenty” so to say.

Thanks anyway.
M

The state/status found in Get-PnpDevice as well as the WMI/CIM classes reflects the hardware connected state (is the device operational) neither of these will show you external bluetooth device connectivity. I am fairly certain you will need to use either a 3rd party utility or library to get those details. Something like this Bluetooth command line tools - work with bluetooth from the command line

Hello,
According to me you can use a PowerShell script, It define your Bluetooth keyboard’s name. Then, create a function to check if this device is connected using Get-PnpDevice. If the device status is “OK,” it means the keyboard is connected and then create a function to set the keyboard layout by modifying the input method tips with Set-WinUserLanguageList.

Hi ebrukilli,

my experience with Get-PnPDevice ist, that it does show the “connected” Bluetooth devices in the attribute “Status”, but it seems to mean rather coupled than actually “connected”. It’s a bit of a pain in the :peach:
Ill try this 3rd party tool mentioned above as a work-around. But I would be still interested in getting a powershell script solution.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.