Update Powershell Version - !!install!!
Write-ColorOutput "Downloading PowerShell installer..." "Cyan"
function Configure-AutoUpdates $configPath = "$env:APPDATA\PowerShell\update-config.json"
$scriptPath = $MyInvocation.MyCommand.Path $arguments = "-NoProfile -ExecutionPolicy Bypass -File `"$scriptPath`"" update powershell version
$installScript = @" sudo mkdir -p /opt/microsoft/powershell/$Version sudo cp -r $extractPath/* /opt/microsoft/powershell/$Version/ sudo chmod +x /opt/microsoft/powershell/$Version/pwsh sudo ln -sf /opt/microsoft/powershell/$Version/pwsh /usr/bin/pwsh "@
[Parameter(Mandatory = $false)] [ValidateSet("Stable", "LTS")] [string]$Channel = "Stable" ) Write-ColorOutput "Downloading PowerShell installer
tar -xzf $InstallerPath -C $extractPath
try $apiUrl = "https://api.github.com/repos/PowerShell/PowerShell/releases" if (-not $IncludePreview) $apiUrl += "/latest" $response = Invoke-RestMethod -Uri $apiUrl -ErrorAction Stop if ($Channel -eq "LTS") Select-Object -First 1 if ($ltsRelease) return @ Where-Object $_.name -match $GetAssetPattern ).browser_download_url ReleaseNotes = $ltsRelease.html_url return @ Version = $response.tag_name.TrimStart('v') DownloadUrl = ($response.assets else Select-Object -First 1 return @ Version = $latestRelease.tag_name.TrimStart('v') DownloadUrl = ($latestRelease.assets update powershell version
Write-ColorOutput "Installing PowerShell on macOS..." "Cyan"