Skip to content

winget_upgrade_all.ps1

Corey Watson edited this page Dec 1, 2025 · 1 revision

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

  1. Checks Windows version requirements
  2. Locates winget executable in WindowsApps
  3. Runs winget upgrade --all with silent options
  4. Logs output to Windows temp directory
  5. 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

Clone this wiki locally