W11 Bluetooth Reset

Associate
Joined
3 Sep 2006
Posts
1,986
Location
London
Hi Everyone. Does anyone know how to fully reset bluetooth on Windows 11, please?

I have a couple bt headphones and a bt speaker which have been connected, and working fine over an ASUS BT500, I usually just alternate a couple, use one/charge the other. Sometimes use the speaker.

Since a recent Win 11 22H2 update one of them stopped working, disconnecting after few minutes, or when audio stopped.

Anyway, the other previously connected devices can't be removed from Windows, the older headphones and speakers. I'm stuck using one set of headphones, and some usb-wired ones. The only thing that changed recently was the successful cumulative udpate (KB5027231)

I'd rather not have to reset windows and have to reinstall everything.

So is it possible to reset just bluetooth, removing all devices?

Win 11 Pro 64-bit, Asus ROG Maximus Z690 hero, latest bios (2305), fwiw.

Thanks in advance.
 
For anyone else with the same problem.: I ended up using a powershell script to remove all devices, restart machine, then re-add them manually as needed.

They wouldn't remove properly from the UI. If they did, they would typically stay in the device manager. Removing from device manager, and some would still persist in the settings UI. Stupid windows (or pebkac). :)
 
For anyone else with the same problem.: I ended up using a powershell script to remove all devices, restart machine, then re-add them manually as needed.

They wouldn't remove properly from the UI. If they did, they would typically stay in the device manager. Removing from device manager, and some would still persist in the settings UI. Stupid windows (or pebkac). :)
Any chance you can link to this Powershell script please? I've had issues with bluetooth before and couldn't find a way to reset it.
 
Sure, usual caveats apply, at your own risk and whatnot.

Worked fine for me, pasted into a PS terminal.

This will display your BT devices from 1 to n, select one of those to remove the device or 0 to exit.


Code:
Source = @"
    [DllImport("BluetoothAPIs.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
    [return: MarshalAs(UnmanagedType.U4)]
    static extern UInt32 BluetoothRemoveDevice(IntPtr pAddress);
    public static UInt32 Unpair(UInt64 BTAddress) {
        GCHandle pinnedAddr = GCHandle.Alloc(BTAddress, GCHandleType.Pinned);
        IntPtr pAddress     = pinnedAddr.AddrOfPinnedObject();
        UInt32 result       = BluetoothRemoveDevice(pAddress);
        pinnedAddr.Free();
        return result;
    }
"@
Function Get-BTDevice {
    Get-PnpDevice -class Bluetooth |
        ?{$_.HardwareID -match 'DEV_'} |
            select Status, Class, FriendlyName, HardwareID,
                # Extract device address from HardwareID
                @{N='Address';E={[uInt64]('0x{0}' -f $_.HardwareID[0].Substring(12))}}
}

################## Execution Begins Here ################

$BTR       = Add-Type -MemberDefinition $Source -Name "BTRemover"  -Namespace "BStuff" -PassThru
$BTDevices = @(Get-BTDevice) # Force array if null or single item

Do {
    If ($BTDevices.Count) {
        "`n******** Bluetooth Devices ********`n" | Write-Host
        For ($i=0; $i -lt $BTDevices.Count; $i++) {
            ('{0,5} - {1} ({2}/{3}/{4})' -f ($i+1), $BTDevices[$i].FriendlyName, $BTDevices[$i].Status, $BTDevices[$i].Class, $BTDevices[$i].Address) | Write-Host
        }
        $selected = Read-Host "`nSelect a device to remove (0 to Exit)"
        If ([int]$selected -in 1..$BTDevices.Count) {
            'Removing device: {0}' -f $BTDevices[$Selected-1].FriendlyName | Write-Host
            $Result = $BTR::Unpair($BTDevices[$Selected-1].Address)
            If (!$Result) {
                "Device removed successfully." | Write-Host
            } Else {
                ("Sorry, an error occured. Return was: {0}" -f $Result) | Write-Host
            }
        }
    } Else {
        "`n********* No devices found ********" | Write-Host
    }
} While (($BTDevices = @(Get-BTDevice)) -and [int]$selected)
Write-Host "`n`nPress any key to exit...";
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');
 
Last edited:
Back
Top Bottom