Update Powershell Version -
else Write-ColorOutput "Installation failed with exit code: $($process.ExitCode)" "Red" return $false
switch ($OS) "Windows" return "win-x64\.msi$" "macOS" return "osx-x64\.pkg$" "Linux" return "linux-x64\.tar\.gz$" default return ".*"
function Configure-AutoUpdates $configPath = "$env:APPDATA\PowerShell\update-config.json" update powershell version
switch ($choice) "1" Write-Host "`nChecking for updates..." -ForegroundColor Yellow & ".\Update-PowerShell.ps1" -WhatIf Read-Host "`nPress Enter to continue" "2" & ".\Update-PowerShell.ps1" -Channel Stable -Cleanup "3" & ".\Update-PowerShell.ps1" -Channel LTS -Cleanup "4" & ".\Update-PowerShell.ps1" -Preview -Cleanup "5" $version = Read-Host "Enter version number (e.g., 7.4.0)" & ".\Update-PowerShell.ps1" -Version $version -Cleanup "6" Show-CurrentVersionInfo Read-Host "`nPress Enter to continue" "7" List-InstalledVersions Read-Host "`nPress Enter to continue" "8" Write-Host "`nPlease use Windows Control Panel or system package manager to uninstall." -ForegroundColor Yellow Read-Host "Press Enter to continue" "9" Configure-AutoUpdates
[Parameter(Mandatory = $false)] [switch]$NoRestart, [Parameter(Mandatory = $false)] [switch]$Preview
[Parameter(Mandatory = $false)] [switch]$Preview,
# Cleanup if ($Cleanup -and (Test-Path $installerPath)) Remove-Item -Path $installerPath -Force Write-ColorOutput "Cleaned up installation files." "Gray" update powershell version
switch ($os) "Windows" $pwshPaths = @( "$env:ProgramFiles\PowerShell\*", "$env:LocalAppData\Microsoft\PowerShell\*" ) "macOS" $pwshPaths = @("/usr/local/microsoft/powershell/*") "Linux" $pwshPaths = @("/opt/microsoft/powershell/*")