Skip to content

Instantly share code, notes, and snippets.

@aetos382
Created November 2, 2016 06:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aetos382/6b9264b09f9da278e31dcc18c218ca12 to your computer and use it in GitHub Desktop.
Save aetos382/6b9264b09f9da278e31dcc18c218ca12 to your computer and use it in GitHub Desktop.
$module = Get-Module -ListAvailable
# $module = Get-InstalledModule
$module |
Select-Object -Property 'Name', 'Version' |
Group-Object -Property 'Name' |
ForEach-Object -PipelineVariable 'm' {
$_.Group |
Sort-Object -Property 'Version' -Descending |
Select-Object -First 1
} |
Find-Module -ErrorAction 'SilentlyContinue' |
Where-Object { $_.Version -gt $m.Version } |
Add-Member -NotePropertyName 'NewerVersion' -NotePropertyValue $m.Version -PassThru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment