Bluetoothデバイスを削除できません

Bluetoothデバイスを削除できません

コンピューターから Bluetooth デバイスを削除できません。

いろいろな方法を試しました。デバイス マネージャー、コントロール パネル、設定、Bluetooth から削除しました。どれも機能しません。

なぜこれが問題なのでしょうか?

たとえば、Bluetooth アダプターを変更したとします。デバイスがまだ残っているため、デバイスを追加できません。新しいアダプターと正しくペアリングされていないため、接続もできません。

デバイスの非表示を解除して削除してみました。デバイス マネージャーに再び表示されます。

かなり昔にいくつかのプログラムが実行した解決策があります。そのプログラムはもう存在しません。

これは多くの Windows 10 で発生するバグです。

どうすればいいですか?

コンピュータがすべてのBluetoothデバイスを「忘れて」、新しいものを開始したいだけです

これらすべての Bluetooth デバイスはどこに保存されていますか? すべて削除できます。

誰かが私に、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)

関連情報