What is Microsoft Winget?
Microsoft winget is a free, open source package manager by Microsoft. It is a command line tool that eliminates the need to manually go through the Microsoft Store to download an app. With winget, users can easily find, install, uninstall, upgrade, and configure applications on any Windows 10 or Windows 11 computer.
FileWave users can now use winget to simplify the management of applications through PowerShell. There are several other things that you can do with this command tool. But before that, the first step is to install winget correctly if the app is not listed in Add/Remove Apps and Features. Here’s how:
How to Install Microsoft Winget on Windows 10 and 11
Step 1. Download the app installer here.
Step 2. Install winget through FileWave in a simple PowerShell script. Note that it is the msixbundle that we’ll want to download.
After installing Microsoft winget, you also need to accept terms before you can use the app. It can be done automatically using PowerShell. Try winget -v to show the version of winget and proceed to a prompt that looks like this:
To make sure that Microsoft winget is authorized, you have to include accept-source-agreements and accept-package-agreements in your first command. You can place this authorization in a custom field for better efficiency, which allows it to be executed every day and ensure that your devices are kept up to date.
Finding the Package
Before you can use winget to install software, you need to see first if the package that you are looking for is in the repository. If you want to install Mozilla Firefox, for example, search for a package using the simple search command below:
Installing the Package
Once the results show, look for the unique identifier (ID). Using the install command of Microsoft winget, you can install the specified application. However, it requires you to specify the exact string to install. Any ambiguity will result in a prompt that will force you to filter the install command to an exact application.
Upgrading the Package
After installing a package, it needs to be updated regularly to ensure that the application is secured and receives feature updates. The process for updating a package is similar to its installation code–making it quick and simple. You just need to use the Microsoft winget upgrade command to update an installed package. And similar to the installation code, you need to specify the exact string to upgrade in order to avoid ambiguity. Otherwise, you won’t be able to proceed. Note that using the –version option allows you to upgrade to a specific version.
Uninstalling the Package
Uninstalling a package is also a fairly straightforward process. Using the uninstall command code, you can remove a specified application. Similar to the two previous command codes, you need to filter the uninstall command to an exact application to avoid ambiguity.
Important Note: The winget list command is a handy command that will let you see all the applications that can be managed using Microsoft winget. It will also show the list of apps that need to be upgraded. The usage is simply winget list, but if we run it through FileWave, we still need to account for our pre-requisites:
How to Place the Microsoft Winget Install, Upgrade, and Uninstall Commands in One Payload/Fileset
Installing, upgrading, or removing an app that is available in the Microsoft winget repository won’t require any code. You just need to have the following Notepad++ example payload/fileset: Notepad++.fileset.zip.
There are three scripts in this fileset:
- The activation script allows FileWave to install Notepad++.
- The verification script lets FileWave upgrade Notepad++ (if there is an upgrade available).
- The pre-uninstallation script enables FileWave to remove Notepad++.
To make this work without editing any code, you just need to pass a launch argument to each script. You set a launch argument in “Get Info” within the fileset contents.
Important Note: The scripts in this payload/fileset have their own launch argument. When you modify or duplicate this fileset, you must also modify their launch argument and change the destination folder name–which prevents your filesets from stepping on each other.
Check out our full and comprehensive guide about Microsoft Winget in our Knowledge Base.
Benefits of Using Microsoft Winget With FileWave
Efficiency. You can easily install your preferred application or tool without needing to download the installer and manually executing it. Since Microsoft winget connects to a repository of existing packages, you just need the name of the application to find it.
Security. All applications are downloaded from one source that is maintained by Microsoft, which ensures that every application is verified and safe to use. This also eliminates the need to go through various websites just to download the installer of the application you need, saving you from accidentally downloading malware.
No code needed. Since Microsoft winget can be placed in a fileset, you only need to execute it to be able to install, upgrade, or uninstall an app from your device. There’s no need for coding. Here’s how you can easily use a Fileset for another winget package:
Step 1. Using the Microsoft winget search command, find the ID of the package you want to install.
Step 2. Duplicate this example fileset.
Step 3. Rename the duplicated fileset.
Step 4. Change the folder name within the scripts folder of the fileset. Make it meaningful and unique to ensure that multiple filesets don’t compete.
Step 5. Set the launch argument for each of the three scripts to the ID of the package you want to install.
Step 6. Save your changes, and test before deploying to production.
Maintenance. With Microsoft winget or tools like FileWave’s Fileset Magic, maintenance to your applications can be done with ease. You can keep your software regularly updated, rollback to a previous version, and replace a missing or corrupted file using FileWave’s Self-Healing Tech.