Last active
November 29, 2018 11:16
-
-
Save Splaxi/305315ca67750e043b42498da40ba972 to your computer and use it in GitHub Desktop.
Test all modules for multiple installed versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Copy & pasted from the work of Jack (@sharepointjack) - http://sharepointjack.com/2017/powershell-script-to-remove-duplicate-old-modules | |
| #Will test all installed modules for multiple versions installed on the machine | |
| $mods = Get-InstalledModule | |
| foreach ($Mod in $mods) { | |
| Write-Host "Checking $($mod.name)" | |
| $latest = Find-Module $mod.name | |
| $specificmods = Get-InstalledModule $mod.name -allversions | |
| Write-Host "$($specificmods.count) versions of this module found [ $($mod.name) ]" | |
| foreach ($sm in $specificmods) { | |
| if ($sm.version -eq $latest.version) | |
| { $color = "green"} | |
| else | |
| { $color = "magenta"} | |
| Write-Host " $($sm.name) - $($sm.version) [highest installed is $($latest.version)]" -foregroundcolor $color | |
| } | |
| Write-Host "------------------------" | |
| } | |
| Write-Host "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment