无法移除任何蓝牙设备

无法移除任何蓝牙设备

我无法从我的计算机上删除任何蓝牙设备。

我试了很多方法。从设备管理器、控制面板、设置、蓝牙中删除它。都没用。

这为什么是一个问题?

假设我更换了蓝牙适配器。我无法添加设备,因为设备仍然在那里。我也无法连接,因为它没有与新适配器正确配对。

我尝试取消隐藏设备并将其删除。设备管理器中再次显示。

有些方案很久以前就已实施了解决方案。该方案已不再存在。

这是许多 Windows 10 中发生的错误。

我应该怎么办?

我只想让我的电脑“忘记”所有蓝牙设备并开始一个新的

这些蓝牙设备都存储在哪里?我可以将它们全部删除。

有人告诉我在 powershell 中粘贴一些内容。类似于 Keith Miller 的回答。

This is the result. not only device I really want to remove is not listed, I cannot remove any devices at all

    Select a device to remove (0 to Exit): 17
    Removing device: Mi Phone mimax 3
    Sorry, an error occured.
    
    ******** Bluetooth Devices ********
    
        1 - Generic Attribute Profile
        2 - Bluetooth LE Generic Attribute Service
        3 - Galaxy A70
        4 - Device Information Service
        5 - 小米蓝牙手柄
        6 - Bluetooth LE Generic Attribute Service
        7 - Generic Attribute Profile
        8 - Bluetooth LE Generic Attribute Service
        9 - Generic Access Profile
       10 - Lenovo A6000
       11 - Bluetooth LE Generic Attribute Service
       12 - MX Master
       13 - Generic Attribute Profile
       14 - Device Information Service
       15 - Device Information Service
       16 - BT-163
       17 - SMI-M1
       18 - Bluetooth LE Generic Attribute Service
       19 - Bluetooth LE Generic Attribute Service
       20 - Avantree Saturn Pro
       21 - Generic Access Profile
       22 - Bluetooth LE Generic Attribute Service
       23 - MX Master
       24 - Generic Access Profile
       25 - Bluetooth LE Generic Attribute Service
    
    Select a device to remove (0 to Exit): 24
    Removing device: Generic Access Profile
    Sorry, an error occured.
    

我正在寻找一个更低级别的解决方案。比如删除一些注册表项或目录。这些设备的所有信息存储在哪里?我只想删除它们

答案1

创建一个还原点以防万一。装置经理,尝试切换视图到Devices by connection并删除USB Host Controller

在此处输入图片描述

让事物检测然后重新启动并查看情况如何。



复制并粘贴以下内容到电源外壳控制台窗口。按<Enter>执行:

$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}' -f ($i+1), $BTDevices[$i].FriendlyName) | 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." | Write-Host}
      }
   }
   Else {
      "`n********* No devices found ********" | Write-Host
   }
} While (($BTDevices = @(Get-BTDevice)) -and [int]$selected)

相关内容