Update Powershell Version May 2026
$msiArguments = @( "/i `"$InstallerPath`"", "/quiet", "/norestart", "ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1", "ENABLE_PSREMOTING=1", "REGISTER_MANIFEST=1" )
.PARAMETER Channel Update channel: "Stable" (default) or "LTS" (Long Term Support). update powershell version
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") Where-Object $_.prerelease -eq $false -and $_.tag_name -match "v\d+\.\d+\.\d+$" -and ($_.body -match "LTS" -or $_.name -match "LTS") return @ Where-Object $_.name -match $GetAssetPattern ).browser_download_url ReleaseNotes = $response.html_url else $releases = Invoke-RestMethod -Uri $apiUrl -ErrorAction Stop $latestRelease = $releases $msiArguments = @( "/i `"$InstallerPath`""