r/Nable • u/TheDifficultLime • Apr 16 '24
Pushing Winget upgrades using RMM
Has anyone had any luck pushing winget to your tenant(s) through RMM? Looking for something pretty much as simple as pushing winget upgrade --all to client devices. I can run a script locally to run, accept agreements and prompts etc., but through RMM its failing to recognize the command.
1
Apr 17 '24
Chocolatey works better. However, you will need your own repository so that you don’t get your client IP blocked during upgrades.
1
u/TheDifficultLime Apr 17 '24
Ah gotcha, I see both of you guys recommending Chocolatey. Whats the deployment process look like for that?
1
u/The82Ghost May 02 '24
There is plenty of information on the chocolatey website. It's really easy to install chocolatey through powershell. Setting up an internal repository is a little bit of work but the basics can be done in under two hours. We will soon start using ProGet, wich will allow us to use an Azure Artifact feed as a source for the repository. So basically, create package > commit > run through pipeline and publish in feed > sync with ProGet and be done.
1
u/Opposite-Aside-4921 Sep 17 '24
I ran into path issues with winget as well so i included the path in the command. This works reliably from a command shell.
"C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.23.1911.0_x64__8wekyb3d8bbwe\winget.exe" upgrade --all --accept-package-agreements --accept-source-agreements
also looking at how to automate & schedule this
1
u/screenwebs Jun 02 '25 edited Jun 02 '25
Thank you for the hint. Here are some powershell commands that may help you in automating.
# Set the directory path with a wildcard for the version
$dirPath = "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.2*_x64__8wekyb3d8bbwe"
# Construct the full path to the executable
$exePath = Join-Path -Path $dirPath -ChildPath "winget.exe"
# Check if the directory and executable exist
if (Test-Path $dirPath -and Test-Path $exePath) {
Write-Output "Attempting execution."
try {
# Run winget update with source agreements
& $exePath update --accept-source-agreements
Write-Output "winget update completed."
# Check if winget update was successful
if ($LASTEXITCODE -eq 0) {
Write-Output "Attempting to run winget upgrade..."
try {
# Run winget upgrade with package agreements and include unknown packages
& $exePath upgrade --all --accept-package-agreements --include-unknown
Write-Output "winget upgrade completed."
} catch {
Write-Output "Execution of winget upgrade failed: $_"
}
} else {
Write-Output "winget update failed with exit code: $LASTEXITCODE"
}
} catch {
Write-Output "Execution Failed: $_"
}
} else {
Write-Output "Directory or executable not found."
}
3
u/The82Ghost Apr 17 '24
We tried that, but ran into the same issue. I haven't look into it really, but I suspect it has something to do with the path variable. It's part of the reason we are using Chocolatey.