Skip to content

Commit b047d0f

Browse files
committed
Add Restart-Bluetooth command and update Invoke-VSDevCmd for VS2019
1 parent 947b201 commit b047d0f

File tree

3 files changed

+45
-3
lines changed

3 files changed

+45
-3
lines changed

Modules/Scripts/Invoke-VsDevCmd.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
Invoke the Visual Studio environment batch script. Should alias this with 'vs'
44
#>
55

6-
$0 = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\Enterprise\Common7\Tools"
6+
$0 = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\Common7\Tools"
77
if (Test-Path $0)
88
{
99
Push-Location $0
1010
}
1111
else
1212
{
13-
$0 = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2017\Professional\Common7\Tools"
13+
$0 = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Professional\Common7\Tools"
1414
if (Test-Path $0)
1515
{
1616
Push-Location $0
1717
}
1818
else
1919
{
20-
Write-Host '... cannot find Visual Studio 2017' -ForegroundColor Red
20+
Write-Host '... cannot find Visual Studio 2019' -ForegroundColor Red
2121
return
2222
}
2323
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<#
2+
.SYNOPSIS
3+
Restarts the Bluetooth radio device on the current machine. This is useful
4+
when the radio stops communicating with a device such as a mouse. The
5+
alternative would be to reboot the system.
6+
7+
.PARAMETER Show
8+
Show the status of the Bluetooth radio.
9+
#>
10+
11+
param(
12+
[switch] $Show
13+
)
14+
15+
$device = Get-PnPDevice | ? { $_.Class -eq 'Bluetooth' -and $_.FriendlyName -match 'Radio' } | Select -First 1
16+
17+
if ($device)
18+
{
19+
Write-Host
20+
Write-Host "... Found $($device.FriendlyName)" -ForegroundColor White
21+
22+
if ($Show)
23+
{
24+
$device | Select *
25+
}
26+
else
27+
{
28+
Write-Host '... disabling' -ForegroundColor DarkGray
29+
$device | Disable-PnpDevice -Confirm:$false | Out-Null
30+
31+
Write-Host '... enabling' -ForegroundColor DarkGray
32+
$device | Enable-PnpDevice -Confirm:$false | Out-Null
33+
}
34+
}
35+
else
36+
{
37+
Write-Host '... Bluetooth radio not found' -ForegroundColor Yellow
38+
}

readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ Remove a System-owned file or directory. Attempts multiple approaches to remove
163163
#### `Repair-Path` [-Invalid] [-Yes]
164164
Clean up the PATH environment variable, removing duplicates, empty values, and optionally paths that do not exist.
165165

166+
#### `Restart-Bluetooth` [-Show]
167+
Restarts the Bluetooth radio device on the current machine. This is useful when the radio stops
168+
communicating with a device such as a mouse. The alternative would be to reboot the system.
169+
166170
#### `Set-Colors` -Name n -Color c [-Bgr] [-Cmd] [-ConEmu] [-PS] [-Background] [-Foreground]
167171
Set a custom value for the specified console color table entry in one or all of the Cmd, PowerShell, and ConEmu consoles. Also optionally set foreground or background color.
168172

0 commit comments

Comments
 (0)