Update StackMonkey.ps1
This commit is contained in:
@@ -102,15 +102,21 @@ Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ConfirmPreference = 'None'
|
||||
|
||||
# if NuGet isn't already available, install it non-interactively
|
||||
# check if NuGet exists (no output—assigned to $nuget)
|
||||
$nuget = Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue
|
||||
|
||||
if (-not (Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyContinue)) {
|
||||
Install-PackageProvider `
|
||||
if (-not $nuget) {
|
||||
# install it (again, assignment suppresses the table)
|
||||
$nuget = Install-PackageProvider `
|
||||
-Name NuGet `
|
||||
-MinimumVersion 2.8.5.201 `
|
||||
-Force `
|
||||
-Confirm:$false `
|
||||
| Out-Null
|
||||
-Confirm:$false
|
||||
|
||||
Write-Host "✔ Installed NuGet provider v$($nuget.Version)" -ForegroundColor Green
|
||||
}
|
||||
else {
|
||||
Write-Host "ℹ NuGet provider already present (v$($nuget.Version))" -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
# import it so Register-PSRepository / Install-Module won't prompt
|
||||
|
||||
Reference in New Issue
Block a user