We noticed that there are some Winget upgrades available that Automox’s native 3rd party patching seems to miss. We have this script that works in the user context, but we are having trouble making it succeed as a worklet because Automox runs as System. Any advice?
# Winget Upgrade All - Silent Execution
# Returns exit codes compatible with Windows Task Scheduler logging
try {
# Run winget upgrade for all packages, silently accepting prompts
winget upgrade --all --accept-package-agreements --accept-source-agreements --silent --include-unknown
$exitCode = $LASTEXITCODE
if ($exitCode -eq 0) {
Write-Output "SUCCESS: All packages upgraded successfully."
exit 0
} else {
Write-Output "WARNING: Winget upgrade completed with exit code $exitCode."
exit $exitCode
}
}
catch {
Write-Error "ERROR: Failed to execute winget upgrade. $_"
exit 1
}

