Update Powershell Version -

sudo mkdir -p /opt/microsoft/powershell/$Version sudo cp -r $extractPath/* /opt/microsoft/powershell/$Version/ sudo chmod +x /opt/microsoft/powershell/$Version/pwsh sudo ln -sf /opt/microsoft/powershell/$Version/pwsh /usr/bin/pwsh "@

elseif ($IsLinux) return "Linux"

if ($currentVersion -ge $newVersion -and -not $Force) Write-ColorOutput "PowerShell is already up to date (Current: $currentVersion, Latest: $newVersion)" "Green" Write-ColorOutput "Use -Force flag to reinstall." "Yellow" exit 0 update powershell version

$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File "$scriptPath`" -NoRestart -Cleanup" update powershell version

.\Install-AutoUpdateTask.ps1