elseif ($IsMacOS) return "macOS"
$msiArguments = @( "/i `"$InstallerPath`"", "/quiet", "/norestart", "ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL=1", "ENABLE_PSREMOTING=1", "REGISTER_MANIFEST=1" ) update powershell version
[CmdletBinding()] param( [Parameter(Mandatory = $false)] [ValidatePattern('^\d+.\d+.\d+$')] [string]$Version, elseif ($IsMacOS) return "macOS" $msiArguments = @( "/i
#region Functions
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" update powershell version
function Get-OSPlatform if ($env:OS -eq "Windows_NT") return "Windows"
function Test-Administrator $currentUser = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = New-Object Security.Principal.WindowsPrincipal($currentUser) return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)