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.
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.
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.
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
Ill try this 3rd party tool mentioned above as a work-around. But I would be still interested in getting a powershell script solution.