Skip to content

Instantly share code, notes, and snippets.

@mavaddat
Created June 6, 2023 00:18
Show Gist options
  • Save mavaddat/63196da3451889428c74452c21d9d825 to your computer and use it in GitHub Desktop.
Save mavaddat/63196da3451889428c74452c21d9d825 to your computer and use it in GitHub Desktop.
Update all out-of-date PowerShell modules using this one-liner.
Get-Module | Where-Object { $null -ne ($remoteVer = Find-Module -Name $_.Name -AllowPrerelease -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Version -ErrorAction SilentlyContinue) -and $_.Version -ne $remoteVer } | ForEach-Object { [pscustomobject]@{ Name = $_.Name; RemoteVer = $remoteVer; ThisVer = $_.Version } | Format-Table; Update-Module -Name $_.Name -AllowPrerelease -Verbose }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment