
# package_name|current_version|latest_version|pinned Invoke-NativeCommand | Select-Object -ExpandProperty OutputContent | # It does mean we have to parse Chocolatey's output but that should be fine.

# Doing it this way means we only have to compute it once as opposed to doing it on every single package. # If we've specified 'upgrade' then grab our list of installed applications and current vs latest versions $ValidExitCodes = 0, 3010, 1641 ) # 30 are success but restart pending/initiated $AcceptedVersionStrings = 'any', 'installed', 'present' ) # A collection of possible package versions strings Throw 'Chocolatey must be run from an elevated PowerShell session.' $currentPrincipal = New-Object ( :: GetCurrent ( ) ) Throw "Chocolatey does not appear to be installed or is not available on your path.`nYou can run 'Install-Chocolatey' to install Chocolatey on your system"

# Special param for pipeline usage from things like import-csv # If passed will upgrade the package to latest if it's already installed
