Skip to content

Commit 89e79de

Browse files
committed
Fix error installing nuget provider in SyncVirtualDesktops script
1 parent a1f22ef commit 89e79de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

experimental/SyncVirtualDesktops.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ $currentWinVer = (Get-CimInstance Win32_OperatingSystem).version
88
$settingsFile = "$((Get-Item $PSCommandPath).BaseName).dat"
99
$settingsUpdated = $false
1010
if (-Not (Get-Module -ListAvailable -Name VirtualDesktop)) {
11-
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
12-
Install-Module -Name VirtualDesktop -Force -Scope CurrentUser
11+
if (-Not (Get-PackageProvider -ListAvailable | Where-Object { $_.Name -eq "NuGet" })) {
12+
Install-PackageProvider -Name NuGet -Force -Scope CurrentUser
13+
}
14+
Install-Module -Name VirtualDesktop -AllowClobber -Force -Scope CurrentUser
1315
$settingsUpdated = $true
1416
} elseif (-Not (Test-Path -Path $settingsFile -PathType Leaf) -Or ($currentWinVer -Ne (Import-Clixml -Path $settingsFile))) {
1517
Update-Module -Name VirtualDesktop -Force

0 commit comments

Comments
 (0)