Skip to content

Instantly share code, notes, and snippets.

@markwragg
Last active January 29, 2019 22:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwragg/2f953494d051b12c170f48111a0d878c to your computer and use it in GitHub Desktop.
Save markwragg/2f953494d051b12c170f48111a0d878c to your computer and use it in GitHub Desktop.
Check for out of date PowerShell modules
$Modules = Get-Module -ListAvailable |
Where-Object { $_.RepositorySourceLocation -like '*powershellgallery*'} |
Group-Object Name |
ForEach-Object { $_.Group | Sort-Object Version -Descending | Select-Object -First 1 }
$ModuleCheck = ForEach ($Module in $Modules) {
Find-Module -Name $Module | Select-Object Name,Version,@{N='InstalledVersion';E={$Module.Version}}
}
$OutOfDateModules = $ModuleCheck | Where-Object {[version]$_.Version -gt [version]$_.InstalledVersion}
$OutOfDateModules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment