test hide nuget table
This commit is contained in:
@@ -94,8 +94,8 @@
|
||||
#region — guarantee NuGet provider is present without prompting
|
||||
|
||||
# ─── Top of script ───
|
||||
Import-Module PackageManagement -Force -ErrorAction SilentlyContinue
|
||||
Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue
|
||||
Import-Module PackageManagement -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
|
||||
# ─── ensure TLS 1.2 + no prompts ───
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
@@ -107,29 +107,38 @@ $nuget = Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyCon
|
||||
|
||||
if (-not $nuget) {
|
||||
# install it (again, assignment suppresses the table)
|
||||
$nuget = Install-PackageProvider `
|
||||
Install-PackageProvider `
|
||||
-Name NuGet `
|
||||
-MinimumVersion 2.8.5.201 `
|
||||
-Force `
|
||||
-Confirm:$false
|
||||
|
||||
Write-Host "✔ Installed NuGet provider v$($nuget.Version)" -ForegroundColor Green
|
||||
|
||||
# re-query just for version info
|
||||
$found = Get-PackageProvider -Name NuGet -ListAvailable
|
||||
Write-Host "Installed NuGet provider v$($found.Version)" -ForegroundColor Green
|
||||
}
|
||||
else {
|
||||
Write-Host "ℹ NuGet provider already present (v$($nuget.Version))" -ForegroundColor DarkGray
|
||||
Write-Host "NuGet provider already present (v$($found.Version))" -ForegroundColor DarkGray
|
||||
}
|
||||
|
||||
# import it so Register-PSRepository / Install-Module won't prompt
|
||||
Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue
|
||||
# now import it silently
|
||||
Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue | Out-Null
|
||||
|
||||
# ensure PSGallery is trusted (so you don't get “untrusted repository” prompt
|
||||
if ((Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue).InstallationPolicy -ne 'Trusted') {
|
||||
# ensure trust PSGallery without its own output (so you don't get “untrusted repository” prompt
|
||||
$gallery = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
|
||||
if ($gallery.InstallationPolicy -ne 'Trusted') {
|
||||
Set-PSRepository `
|
||||
-Name PSGallery `
|
||||
-InstallationPolicy Trusted `
|
||||
-ErrorAction SilentlyContinue
|
||||
-ErrorAction SilentlyContinue | Out-Null
|
||||
|
||||
Write-Host "PSGallery marked as Trusted" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# …and only *after* this completes* do you Start-Server…
|
||||
Write-Host "Starting ScriptMonkey UI on http://localhost:$Port/" -ForegroundColor Cyan
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user