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"
else Write-ColorOutput "Checking for latest version..." "Cyan" $versionInfo = Get-LatestPowerShellVersion -IncludePreview $Preview -Channel $Channel
function Test-Administrator $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = New-Object Security.Principal.WindowsPrincipal($currentUser) return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
[CmdletBinding()] param( [Parameter(Mandatory = $false)] [ValidatePattern('^\d+.\d+.\d+$')] [string]$Version,
.EXAMPLE .\Update-PowerShell.ps1