[Parameter(Mandatory = $false)] [switch]$Cleanup,
function Download-PowerShellInstaller param( [string]$DownloadUrl, [string]$DestinationPath ) update powershell version
else Write-ColorOutput "Installation failed. Please check the error messages above." "Red" exit 1 [Parameter(Mandatory = $false)] [switch]$Cleanup
catch Write-ColorOutput "Failed to fetch version information: $_" "Red" return $null update powershell version
Clear-Host Write-ColorOutput "========================================" "Cyan" Write-ColorOutput " PowerShell Update Tool v2.0" "Cyan" Write-ColorOutput "========================================" "Cyan" Write-ColorOutput "" $os = Get-OSPlatform Write-ColorOutput "Detected OS: $os" "Yellow" Write-ColorOutput "Current PowerShell Version: $(Get-CurrentPowerShellVersion)" "Yellow"
if (-not $versionInfo) Write-ColorOutput "Failed to get version information. Exiting." "Red" exit 1
#region Main Execution