-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbluetooth.ps1
More file actions
18 lines (15 loc) · 782 Bytes
/
bluetooth.ps1
File metadata and controls
18 lines (15 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Restart Bluetooth service with Force flag
Restart-Service -Name BthServ -Force
# Check if any Bluetooth devices are disabled and attempt to enable them
$disabledDevices = Get-PnpDevice | Where-Object {$_.FriendlyName -like "*Bluetooth*" -and $_.Status -eq "Error"}
if ($disabledDevices) {
Write-Host "Enabling disabled Bluetooth devices..."
foreach ($device in $disabledDevices) {
Enable-PnpDevice -InstanceId $device.InstanceId -Confirm:$false
}
}
# Automatically run Bluetooth troubleshooter
$troubleshooterPath = "$env:SystemRoot\System32\msdt.exe"
$troubleshooterArgs = "-id BluetoothDiagnostic"
Start-Process -FilePath $troubleshooterPath -ArgumentList $troubleshooterArgs -Wait
Write-Host "Bluetooth driver troubleshooting completed."