Update StackMonkey.ps1
This commit is contained in:
@@ -102,15 +102,21 @@ Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue
|
|||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
$ConfirmPreference = 'None'
|
$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)) {
|
if (-not $nuget) {
|
||||||
Install-PackageProvider `
|
# install it (again, assignment suppresses the table)
|
||||||
|
$nuget = Install-PackageProvider `
|
||||||
-Name NuGet `
|
-Name NuGet `
|
||||||
-MinimumVersion 2.8.5.201 `
|
-MinimumVersion 2.8.5.201 `
|
||||||
-Force `
|
-Force `
|
||||||
-Confirm:$false `
|
-Confirm:$false
|
||||||
| Out-Null
|
|
||||||
|
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
|
# import it so Register-PSRepository / Install-Module won't prompt
|
||||||
|
|||||||
Reference in New Issue
Block a user