winget_upgrade_all.ps1 - limehawk/rmm-scripts GitHub Wiki
winget_upgrade_all.ps1
Upgrades all winget-managed packages to their latest versions.
Overview
Upgrades all winget-managed packages to their latest versions. Includes logging and automatic cleanup of old log files.
Purpose
Upgrades all winget-managed packages to their latest versions. Includes logging and automatic cleanup of old log files.
Prerequisites
- Windows 10 1809+ or Windows 11 or Server 2022
- Administrator privileges
- winget (App Installer) installed
Configuration
Required Inputs
None
Behavior
- Checks Windows version requirements
- Locates winget executable in WindowsApps
- Runs winget upgrade --all with silent options
- Logs output to Windows temp directory
- Cleans up logs older than 14 days
Security Notes
- No secrets in logs
- Accepts all package agreements automatically
Exit Codes
- 0 = Success
- 1 = Failure (system requirements not met)
Example Output
[ SYSTEM CHECK ]
--------------------------------------------------------------
Windows Version : 10.0.22631
Product Type : Workstation
Requirements met
[ UPGRADE ]
--------------------------------------------------------------
Locating winget executable...
Running winget upgrade --all...
[Upgrade output...]
Upgrade completed
[ LOG CLEANUP ]
--------------------------------------------------------------
Cleaning up logs older than 14 days...
Cleanup completed
[ FINAL STATUS ]
--------------------------------------------------------------
Result : SUCCESS
Log file : C:\Windows\temp\winget-upgrade-log_2024-12-01.txt
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
Version History
- 2024-12-01 v1.0.0 - Initial release - migrated from SuperOps
Links
- View Script Source
- Scripts - Back to script index