Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tools/install-powershell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ $architecture = if (-not $IsWinEnv) {
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
New-Item -ItemType Directory -Path $tempDir -Force > $null
try {
# Setting Tls to 12 to prevent the Invoke-WebRequest : The request was
# aborted: Could not create SSL/TLS secure channel. error.
$originalValue = [Net.ServicePointManager]::SecurityProtocol
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12

if ($Daily) {
if (-not (Get-Module -Name PackageManagement -ListAvailable)) {
throw "PackageManagement module is required to install daily PowerShell Core."
Expand Down Expand Up @@ -227,5 +232,8 @@ try {
Write-Host "Please restart pwsh" -ForegroundColor Magenta
}
} finally {
# Restore original value
[Net.ServicePointManager]::SecurityProtocol = $originalValue

Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue
}