Skip to main content

Uninstalling a package with WinGet

What

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

Note that FileWave 15.4 or later is required.

When/Why

After we initially install any package, we most likely will have reason to uninstall it at some point...and we can use this very practically in a pre or post-uninstall script within a payload/fileset.

How

The process for removing a package is very similar to our installation and upgrade code, and equally simple.  We'll use WinGet to remove a previously installed package.  Clicking the Fileset and then Properties in the toolbar will bring you to the settings which will control if a WinGet application is removed by breaking the Association or Deployment.

image.png

Below is the properties dialog for the Fileset. 

image.png

Things to consider on the properties dialog:

  • Name - Is it the name you expected?
  • URL - The publisher of the software. Go there and confirm it is what you expected.
  • Uninstall when made passive - Do you want it to uninstall when the Association or Deployment is removed? Checking this box will make it so that if the Association or Deployment is removed in the future, the software should silently uninstall.

Keep in mind that some software does not silently uninstall so you should always test if you are going to enable this option. The uninstall functionality is up to the software vendor to implement properly. What our testing has found, though, is that the uninstall will only be "silent" if the 3rd party includes a QuietUninstallString in HKLM/Software/Microsoft/Windows/CurrentVersion/Uninstall.  In the case of Firefox, Mozilla provides no such string...they only provide an UninstallString, which does prompt.  So, "silent" in this case is not silent.  As always, testing of these items before production rollout is always recommended.

Digging Deeper

You may be asking yourself can I make the uninstall silent if it isn't? Yes, probably. In the case of Firefox for instance, the uninstall string calls an executable called helper.exe. That executable, though, when run with a /S flag, will actually uninstall the application silently. So the command to do this could be placed into an Activation script on a separate Fileset to accomplish it instead of using the WinGet command if you find you need to solve for this.