Skip to content

Instantly share code, notes, and snippets.

@royvou
Created December 22, 2024 22:31
Show Gist options
  • Save royvou/d0a1bddcaa1ba06aec413b2a2573a71f to your computer and use it in GitHub Desktop.
Save royvou/d0a1bddcaa1ba06aec413b2a2573a71f to your computer and use it in GitHub Desktop.
Get-InstalledModule | ForEach-Object {
Write-Verbose "Uninstalling old versions of $($_.Name) [latest is $($_.Version)]" -Verbose
Get-InstalledModule -Name $_.Name -AllVersions | Where-Object { $_.Version -ne $_.Version } | Uninstall-Module -Verbose
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment