如何在 Windows 10 中彻底删除/卸载蓝牙驱动程序?

如何在 Windows 10 中彻底删除/卸载蓝牙驱动程序?

我想从 QUALCOMM 切换到 Realtek,但每当我从设备管理中卸载蓝牙驱动程序并运行 Realtek 安装时,它都会抛出一个错误“系统中有未经授权的蓝牙适配器,请移除或禁用该设备”,并且无论我尝试卸载以前的蓝牙驱动程序多少次,它都会自行重新出现,如果您能帮助我解决这个问题,我将不胜感激

另外我想切换驱动程序的原因是使用高通驱动程序时我的蓝牙不会显示任何可用的设备配对,我也尝试过故障排除,修复服务设置,但似乎没有任何效果,不知道是软件问题还是硬件问题(也请解释一下这个问题):)

答案1

不确定你的问题的驱动因素,但以下电源外壳代码将允许您以交互方式删除之前保存的设备。因此请尝试删除所有设备,看看是否有帮助。

$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)

复制并粘贴整个代码块到电源外壳控制台窗口并按Enter。然后您将看到所有已保存设备的列表:

******** Bluetooth Devices ********

    1 - Chill Out
    2 - Pixel 6
    3 - LG HBS730
    4 - Pixel 6
    5 - Pixel 6
    6 - Pixel 6

Select a device to remove (0 to Exit):

删除设备后,会出现更新列表,直到删除所有设备或按下0退出。

相关内容