5

I'm trying to automate connecting my AirPods so I don't have to manually do it each time I log on to my machine for a meeting. Windows remembers my AirPods since they were previously paired. I don't need to automate the pairing, but I'd like to automate the following (scribbling out actual names):

  1. Clicking connect here.

Windows Bluetooth & other devices

  1. Selecting the audio device here:

Selecting Audio Output Device

From my initial searching, I found this post:

How to connect and disconnect a Bluetooth device with a PowerShell script on Windows?

I am running powershell as Admin. At first, I attempted the steps in the aforementioned post as-is (which filters for Bluetooth -- I found friendlyname by calling Get-PnpDevice with nothing after it, and just reading through the list), but I realized after playing with it and not seeing anything, that it's actually returning two devices - presumably one for each headphone:

$device = Get-PnpDevice -class Bluetooth -friendlyname "AirPods Pro Avrcp Transport"
Enable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false


PS C:\WINDOWS\system32> $device

returns the following:

Return from Enable-PnpDevice

That's okay because the MSDN documentation says one can input a string[] for InstanceId, but ultimately running Enable on these bluetooth devices Ids did nothing for me. So then I realized, the device shows up as Audio in the image above, and ran the following:

$device = Get-PnpDevice -class AudioEndpoint -friendlyname "Headphones (AirPods Pro Stereo)"
Enable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false

Which returns the following:

PowerShell Error Message

I don't know what to make of the error messages:

CategoryInfo: NotSpecified: (Win32_PnPEntity...}.{EB5535DA...):ROOT\cimv2\Win32_PnPEntity)[Enable-PnpDevice], CimException
FullyQualifiedErrorId : HRESULT 0x80041001,Enable-PnpDevice

I'm out of ideas and can't find anything from searching. Any ideas or info?

EDIT: I have found that if I manually do step 1. above, the error message goes away, but I don't really see a change in Windows (so similar behavior to running the Bluetooth InstanceIds)

4
  • 5
    Had the same problem, and found that windows shortcut Win+K opens the window with bluetooth devices Commented Jan 12, 2022 at 12:44
  • hmmm yeah that's probably equivalent to writing a script to automate it. Commented Jan 12, 2022 at 21:04
  • 1
    Win+K stops working for Bluetooth in Windows 11 :( The closest I've found is Win+A, but that just opens the control panel thing, and tabbing over to Bluetooth requires a weird mix of keystrokes. Commented May 1 at 20:48
  • In Windows 11, to open the Bluetooth pop-up, assuming that your Action Center starts with the Wi-Fi widget, then Bluetooth widget, you can use this keyboard "shortcut": [Win]+[A], [Right Arrow], [Tab], [Enter] -or- [Win]+[A], [Tab], [Right Arrow], [Tab], [Enter] Commented Nov 18 at 18:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.