Installing a Package with Winget

What

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

When/Why

We'll certainly want to use winget to push software to our devices, and we can do that rather nicely in a FileWave fileset/payload.

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

In our previous article, we looked at how we can find and uniquely identify a specific package to install (here).  And we also covered in an earlier document the special considerations for running winget through FileWave (here).  And once we have those building blocks in place, it is rather simple to install an application, as you'll see 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
# the "scope" defines that the install is for the device, and not just for current user
# "silent" is the default option, but we'll specify that as well for good measure
./winget install --id Mozilla.Firefox --accept-package-agreements --accept-source-agreements --scope machine --silent

Our example here is simple, but there are lots of options available for the winget install command.  You'll find Microsoft's detailed reference here. (--version may be of particular interest...and on the surface --silent seems important, but since we run in system account no progress indicator is shown anyway).

Note that the fileset/payload log file shows a nice amount of detail:

Related Content

For troubleshooting purposes, the verbose logging options are very helpful.  You'll find information on --verbose-logs within the Microsoft reference here: https://docs.microsoft.com/en-us/windows/package-manager/winget/install and this flag is the same for the upgrade command as well.