How to Automate Winget Upgrades via GPO?
Asked by
caliper student
Hey there! I'm looking for some help with upgrading common applications using `winget upgrade` across all the computers in my company. I can run it manually without any issues, but since we have over 300 devices on the network, I'm trying to automate the process.
I've set up a Group Policy Object (GPO) that triggers a batch script with the SYSTEM account to ensure it has the necessary admin privileges. The problem is, it seems the SYSTEM account doesn't have access to `winget`. I even attempted to install `winget` for the SYSTEM account, but that didn't work either.
I've been stuck on this for a few days now and I'm out of ideas. Has anyone been able to do this successfully or can offer some advice?
Answers
If you're using PowerShell in the SYSTEM context, you can try this command: `$wingetCmd = 'cd "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe" && winget.exe upgrade --all --silent --accept-package-agreements --accept-source-agreements'`. This has worked for me before in similar situations. Just make sure the path to `winget` is correct!
Reply to this answer
You might want to check out this GitHub link: https://github.com/Romanitho/Winget-AutoUpdate. It's a good resource for automating `winget` updates, and it could save you some time!
Reply to this answer
Add your answer
Answers are reviewed before publication.
_lactoBatch: Thanks for the tip! I'll definitely take a look and see how I can incorporate it into my setup.