test hide nuget table
This commit is contained in:
@@ -94,8 +94,8 @@
|
|||||||
#region — guarantee NuGet provider is present without prompting
|
#region — guarantee NuGet provider is present without prompting
|
||||||
|
|
||||||
# ─── Top of script ───
|
# ─── Top of script ───
|
||||||
Import-Module PackageManagement -Force -ErrorAction SilentlyContinue
|
Import-Module PackageManagement -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue
|
Import-Module PowerShellGet -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
# ─── ensure TLS 1.2 + no prompts ───
|
# ─── ensure TLS 1.2 + no prompts ───
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
@@ -107,29 +107,38 @@ $nuget = Get-PackageProvider -Name NuGet -ListAvailable -ErrorAction SilentlyCon
|
|||||||
|
|
||||||
if (-not $nuget) {
|
if (-not $nuget) {
|
||||||
# install it (again, assignment suppresses the table)
|
# install it (again, assignment suppresses the table)
|
||||||
$nuget = Install-PackageProvider `
|
Install-PackageProvider `
|
||||||
-Name NuGet `
|
-Name NuGet `
|
||||||
-MinimumVersion 2.8.5.201 `
|
-MinimumVersion 2.8.5.201 `
|
||||||
-Force `
|
-Force `
|
||||||
-Confirm:$false
|
-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 {
|
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
|
# now import it silently
|
||||||
Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue
|
Import-PackageProvider -Name NuGet -Force -ErrorAction SilentlyContinue | Out-Null
|
||||||
|
|
||||||
# ensure PSGallery is trusted (so you don't get “untrusted repository” prompt
|
# ensure trust PSGallery without its own output (so you don't get “untrusted repository” prompt
|
||||||
if ((Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue).InstallationPolicy -ne 'Trusted') {
|
$gallery = Get-PSRepository -Name PSGallery -ErrorAction SilentlyContinue
|
||||||
|
if ($gallery.InstallationPolicy -ne 'Trusted') {
|
||||||
Set-PSRepository `
|
Set-PSRepository `
|
||||||
-Name PSGallery `
|
-Name PSGallery `
|
||||||
-InstallationPolicy Trusted `
|
-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
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user