Upgrading a Package with Winget

What

Winget is a command line tool to manage applications on the Windows 10 and 11 platform.

When/Why

Of course, installing a package is only the beginning.  After we initially install any package, we'll have to come back from time to time to update that application for security and feature updates.

Similarly to other platforms where installs are coming directly from a CDN source, any software installed in this method will bypass FileWave boosters since the content is coming straight from the internet.

How

Our process for updating a package is very similar to our installation code, and equally simple.  We'll use the winget "upgrade" command to update a previously installed package.  You'll find Microsoft documentation on the upgrade command here.  And the upgrade command is shown in action in the last line below:

# because we run this from system account, we must define where winget is...the registry tells us
$winget_locale=Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\winget.exe" -Name Path -ErrorAction SilentlyContinue

# we change directory to this locale so we can run the winget command without the full path
cd $winget_locale.Path

# adding the authorization acceptance here is superfluous if it has already been accepted, but it won't harm anything to include
./winget upgrade --id Mozilla.Firefox --accept-package-agreements --accept-source-agreements

Utilization of the --version option may be very helpful as well since it lets you control upgrading to a specific version.