Update StackMonkey.ps1

This commit is contained in:
2025-06-28 20:38:42 -04:00
parent ace8b1139a
commit 1982b93475

View File

@@ -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)
-Name NuGet ` $nuget = Install-PackageProvider `
-MinimumVersion 2.8.5.201 ` -Name NuGet `
-Force ` -MinimumVersion 2.8.5.201 `
-Confirm:$false ` -Force `
| 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 # import it so Register-PSRepository / Install-Module won't prompt