-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathRestart-Bluetooth.ps1
More file actions
38 lines (32 loc) · 851 Bytes
/
Restart-Bluetooth.ps1
File metadata and controls
38 lines (32 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<#
.SYNOPSIS
Restarts the Bluetooth radio device on the current machine. This is useful
when the radio stops communicating with a device such as a mouse. The
alternative would be to reboot the system.
.PARAMETER Show
Show the status of the Bluetooth radio.
#>
param(
[switch] $Show
)
$device = Get-PnPDevice | ? { $_.Class -eq 'Bluetooth' -and $_.FriendlyName -match 'Radio' } | Select -First 1
if ($device)
{
Write-Host
Write-Host "... Found $($device.FriendlyName)" -ForegroundColor White
if ($Show)
{
$device | Select *
}
else
{
Write-Host '... disabling' -ForegroundColor DarkGray
$device | Disable-PnpDevice -Confirm:$false | Out-Null
Write-Host '... enabling' -ForegroundColor DarkGray
$device | Enable-PnpDevice -Confirm:$false | Out-Null
}
}
else
{
Write-Host '... Bluetooth radio not found' -ForegroundColor Yellow
}