
Thanks to this code, I can create an array of application I do not want to update with winget.

An example of the output is contained in Figure 1.įigure 1: Parse winget upgrade output to have array of PowerShell objects. Launching that script you can find that you are indeed able to havea $upgradelist array of real PowerShell object containing all the software that needs upgrade on your system. $version = $line.Substring($versionStart, $availableStart - $versionStart).TrimEnd() $id = $line.Substring($idStart, $versionStart - $idStart).TrimEnd() $name = $line.Substring(0, $idStart).TrimEnd() If ($line.Length -gt ($availableStart + 1) -and -not $line.StartsWith( '-')) $upgradeList = ($i = $fl + 1 $i -le $lines.Length $i++) # Now cycle in real package and split accordingly $availableStart = $lines.IndexOf( "Available") $versionStart = $lines.IndexOf( "Version") # Line $i has the header, we can find char where we find ID and Version # Find the line that starts with Name, it contains the header


$upgradeResult = winget upgrade | Out-String
