Skip to content

Instantly share code, notes, and snippets.

@turboBasic
Last active June 27, 2018 12:24
Show Gist options
  • Save turboBasic/3e129ef62af53a69ca9949a77e79fef3 to your computer and use it in GitHub Desktop.
Save turboBasic/3e129ef62af53a69ca9949a77e79fef3 to your computer and use it in GitHub Desktop.
[Get-OutdatedChocoPackages.ps1] Get outdated #chocolatey packages #powershell
$outdated = (choco outdated) -join "`n"
$outdated = ($outdated -replace '(?sx) ^ .* \n\n (.*) \n\n .* $', '$1') -split "`n"
$outdated |
ForEach-Object {
if ($_ -match '(?x) ^ (?<name> [^|]+) \| (?<old> [^|]+) \| (?<new> [^|]+) \| (?<pinned> [^|]+) $') {
[psCustomObject] $Matches
}
} |
Select-Object Name, New, Old, Pinned
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment