Skip to content
Menu

Uninstall an Application Silently by Name

Finds installed applications by name, runs each one's silent uninstaller and checks the entry is gone. Refuses short names and, by default, multiple matches. Dry run until approved.

Uninstall an application silently by name is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Uninstall an application silently by name. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, Windows Server 2016+; runs as SYSTEM
NeedsPowerShell 5.1, administrator rights
Changes thingsChanges what it runs on

What It Does

The script finds installed applications whose name matches Name in the machine-wide installed-programs list, 64-bit and 32-bit, runs each one's silent uninstaller and checks the entry is gone. It never touches per-user installs, Microsoft Store apps, updates, hotfixes, system components or entries marked as not removable.

For a Windows Installer package it runs msiexec with the product code, quietly and with no restart. Otherwise it uses the application's own quiet uninstall command, or its uninstall command with the silent switch of an installer type it positively identifies: NSIS, Inno Setup or a WiX bundle. With no known silent method it stops with an error naming the application, and never starts an interactive uninstaller.

A name without wildcards matches anywhere in the application name; ExactMatch requires the whole name. More than one match is an error that lists them, unless AllowMultiple is true, and a name with fewer than three letters outside wildcards is refused. Exit codes that mean a restart is needed are reported as success with a reboot note; the script never restarts.

Before You Run It

  • Run the dry run on one machine and check it found exactly the application you meant, and only that one.
  • Use Publisher or ExactMatch when the name is a common word that other applications share.
  • Set your RMM's timeout above TimeoutSeconds, so the RMM does not give up before the uninstaller does.
  • Plan the restart for applications that ask for one. The answer tells you which.

Type and Risk

  • Type: Action. It makes its change, checks the change worked and says what changed. It exits 0, or 2 when it could not do the job.
  • Risk: High. It is a dry run unless you set both DryRun=false and Approve=uninstall-application, and it stops before making more than 25 changes in one run unless you raise MaxChanges. Run it once as a dry run and read the list first.
  • What it changes: Runs the silent uninstaller of each matching application.
  • Restart: It never restarts the machine itself. When a restart is needed to finish, the answer says so.
  • Typical run: 1 to 10 minutes.
  • Example answer: "Uninstalled Zoom 6.2.5; reboot needed"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • Name: Application name to remove, as shown in Apps & features. Wildcards * and ? work. Required.
  • ExactMatch: true to require the whole name to match instead of a part of it. Default false.
  • Publisher: Only applications whose publisher contains this text. Default empty.
  • AllowMultiple: true to remove every match instead of stopping when there are several. Default false.
  • TimeoutSeconds: How long to wait for each uninstaller. Whole number, 30 to 7200. Default 600.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

uninstall-application.ps1 · 1022 lines · 50.9 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.