# Equivalent manual check: $latest = Invoke-RestMethod -Uri 'https://api.github.com/repos/PowerShell/PowerShell/releases/latest' $current = $PSVersionTable.PSVersion if ($latest.tag_name.TrimStart('v') -gt $current) Write-Host "Update available: $current -> $latest.tag_name"
# Update a specific module Update-Module -Name Az Update all installed modules Get-InstalledModule | Update-Module Update to a specific version Update-Module -Name Pester -RequiredVersion '5.3.3' Force update even if already latest Update-Module -Name PSReadLine -Force Scope: User vs AllUsers Update-Module -Name VMware.PowerCLI -Scope CurrentUser powershell update command
Write-Log "Starting PowerShell update process..." if ($PSVersionTable.PSVersion.Major -ge 7) try Write-Log "Checking for PowerShell Core update..." $oldVersion = $PSVersionTable.PSVersion.ToString() $result = Update-PowerShell -Stable -PassThru -Force -ErrorAction Stop Write-Log "PowerShell updated from $oldVersion to $($result.NewVersion)" # Equivalent manual check: $latest = Invoke-RestMethod -Uri