Dec 01 2021 05:29 PM
Good morning
Has anybody started serious work on managing their corporate devices via this solution, especially in deployment and patch management.
I am unable to find an official Microsoft repository for the management of applications in GitHub which tells me Microsoft are not managing devices via WinGet and although I have found work via various MVPs on this new functionality it seems to be limited to initial deployment.
Anybody doing serious work with this?
In my humble unprofessional opinion (hobbyist) this functionality would solve many problems.
I have noticed that Microsoft.Office aka Microsoft 365 Apps for enterprise when deployed via this method installs the x86 application on x64 hardware, which is not my preferred solution, so if anybody knows where to find the appropriate switches, I would appreciate a heads up.
I have included my test code (work of another) with a few minor modifications. Its basically proactive remediation - MEM, ready but for a couple of lines.
<#
Reference
https://www.codewrecks.com/post/general/winget-update-selective/
Notes
This code is the work of Gian Maria and has been published on the above link
This code has been tested to ensure it works on a upgrade case and a no upgrade case
The code is missing the actual upgrade command which is
winget upgrade --all --force --accept-package-agreements --accept-source-agreements
The code is not proactive remediation ready, but can be with a couple of exit statements.
#>
class Software {
[string]$Name
[string]$Id
[string]$Version
[string]$AvailableVersion
}
$upgradeResult = winget upgrade | Out-String
if (!($upgradeResult -match "No installed package found matching input criteria."))
{
Write-Host "There is something to update" -ForegroundColor Green
$lines = $upgradeResult.Split([Environment]::NewLine)
# Find the line that starts with Name, it contains the header
$fl = 0
while (-not $lines[$fl].StartsWith("Name"))
{
$fl++
}
# Line $i has the header, we can find char where we find ID and Version
$idStart = $lines[$fl].IndexOf("Id")
$versionStart = $lines[$fl].IndexOf("Version")
$availableStart = $lines[$fl].IndexOf("Available")
$sourceStart = $lines[$fl].IndexOf("Source")
# Now cycle in real package and split accordingly
$upgradeList = @()
For ($i = $fl + 1; $i -le $lines.Length; $i++)
{
$line = $lines[$i]
if ($line.Length -gt ($availableStart + 1) -and -not $line.StartsWith('-'))
{
$name = $line.Substring(0, $idStart).TrimEnd()
$id = $line.Substring($idStart, $versionStart - $idStart).TrimEnd()
$version = $line.Substring($versionStart, $availableStart - $versionStart).TrimEnd()
$available = $line.Substring($availableStart, $sourceStart - $availableStart).TrimEnd()
$software = [Software]::new()
$software.Name = $name;
$software.Id = $id;
$software.Version = $version
$software.AvailableVersion = $available;
$upgradeList += $software
}
}
$upgradeList | Format-Table
#Actual upgrade command - been removed as this code needs to be rewritten for proactive remediation
#winget upgrade --all --force --accept-package-agreements --accept-source-agreements
}
else
{
Write-Host "There is nothing to upgrade" -ForegroundColor Yellow
}
Thankyou for reading and like I said, I'm a hobbyist in a test tenant but keen to learn.
Sincerely.
Jan 02 2022 08:37 PM
I am just starting on this.. I am using Intune and its scripts feature to begin work on automating the installs of several apps through Winget... I was surprised when I ran "Winget list" and saw how many already installed apps we had that were compatible with Winget....
Nov 21 2022 08:05 AM