修复蓝牙耳机音频问题

Windows 11更新后,蓝牙连接耳机无法播放声音而只能当话筒,想办法彻底解决这个问题,写了一个脚本出来

#
# 脚本修复Windows 11蓝牙耳机只能作为话筒但不能播放声音的问题
# 以管理员权限运行此脚本

# 检查管理员权限
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    Write-Warning "请以管理员权限运行此脚本!"
    break
}

Write-Host "正在修复蓝牙耳机音频问题..." -ForegroundColor Cyan

# 1. 重启相关的音频服务
Write-Host "步骤1: 重启音频服务..." -ForegroundColor Yellow
$audioServices = @("Audiosrv", "AudioEndpointBuilder", "BthAvctpSvc")
foreach ($service in $audioServices) {
    Stop-Service -Name $service -Force -ErrorAction SilentlyContinue
    Start-Service -Name $service -ErrorAction SilentlyContinue
    $status = Get-Service -Name $service -ErrorAction SilentlyContinue
    if ($status.Status -eq "Running") {
        Write-Host "  - 服务 $service 已重启" -ForegroundColor Green
    } else {
        Write-Host "  - 服务 $service 重启失败或不存在" -ForegroundColor Red
    }
}

# 2. 重置蓝牙子系统
Write-Host "步骤2: 重置蓝牙子系统..." -ForegroundColor Yellow
Get-Service bthserv | Stop-Service -Force
Start-Sleep -Seconds 2
Get-Service bthserv | Start-Service
Write-Host "  - 蓝牙服务已重置" -ForegroundColor Green

# 3. 清除并重新注册音频组件
Write-Host "步骤3: 重置音频组件..." -ForegroundColor Yellow
cmd /c "regsvr32 /s wmnetmgr.dll"
cmd /c "regsvr32 /s /u wmnetmgr.dll"
cmd /c "regsvr32 /s wmnetmgr.dll"
Write-Host "  - 音频组件已重置" -ForegroundColor Green

# 4. 重置声音设置
Write-Host "步骤4: 重置Windows音频设置..." -ForegroundColor Yellow
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Multimedia\Audio" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio" -Recurse -Force -ErrorAction SilentlyContinue
Write-Host "  - 音频设置已重置" -ForegroundColor Green

# 5. 检查蓝牙驱动
Write-Host "步骤5: 检查蓝牙驱动更新..." -ForegroundColor Yellow
$bluetoothDevices = Get-PnpDevice | Where-Object { $_.Class -eq "Bluetooth" }
if ($bluetoothDevices) {
    foreach ($device in $bluetoothDevices) {
        Write-Host "  - 找到蓝牙设备: $($device.FriendlyName)" -ForegroundColor Green
    }
    Write-Host "  - 提示: 建议到设备管理器检查驱动是否为最新版本" -ForegroundColor Yellow
} else {
    Write-Host "  - 未找到蓝牙设备" -ForegroundColor Red
}

Write-Host "`n修复完成!请按照以下步骤操作:" -ForegroundColor Cyan
Write-Host "1. 移除蓝牙耳机连接" -ForegroundColor White
Write-Host "2. 重启电脑" -ForegroundColor White
Write-Host "3. 重新连接蓝牙耳机" -ForegroundColor White
Write-Host "4. 右键点击系统托盘的声音图标,选择'打开声音设置'" -ForegroundColor White
Write-Host "5. 确保蓝牙耳机被设置为默认播放设备" -ForegroundColor White
Write-Host "6. 如果仍有问题,尝试进入蓝牙设备属性,检查'服务'选项卡中的'音频'选项是否启用" -ForegroundColor White

Read-Host -Prompt "按回车键退出"

使用说明:

  1. 将此代码保存为Fix-BluetoothAudio.ps1文件
  2. 以管理员身份运行PowerShell
  3. 执行脚本:.\Fix-BluetoothAudio.ps1
  4. 按照脚本结束时的提示进行操作

此脚本会重启音频服务、重置蓝牙堆栈、重新注册音频组件并清除相关注册表项,应该是能解决Windows 11更新后蓝牙耳机无法播放声音的问题。

Category
Tagcloud
Life GeoPython VTK FuckZhihu Telescope GlumPy CUDA Mount&Blade macOS Pyenv Software Junck Windows11 PyOpenCL Linux Python QEMU Chat Book Disease ChromeBook Moon Hate Programming Hadoop Translate Download RaspberryPi Server Scholar Hardware 耳机 IDE Learning Poem Raspbian QGIS Geology Communicate 蓝牙 Data Story Lens Lesson Library Hackintosh FckZhiHu 音频 Game Radio Mac MayaVi Camera Kivy HBase Xcode Hack FuckChunWan QT Conda Microscope Translation Science OpenCL GIS Video Memory University Virtualization DIY Photo VisPy NAS RTL-SDR PHD Shit VirtualBox Discuss Visualization Photography