Library / Windows endpoint

WIN-025 · Script

Silent Software Uninstall by Name

Finds installed software by display name and, in Remove mode, uninstalls it silently.

Version 1.0.0Language PowerShellUpdated November 2026

What it does

Searches the 64-bit and 32-bit uninstall registry keys, plus the per-user keys of users who are signed in, for programs whose display name matches -DisplayName (wildcards allowed). Optional -Publisher and -ExcludeName filters narrow the match.

For each match the silent uninstall command is chosen in this order: 1. Windows Installer (MSI) products: msiexec /x {ProductCode} /qn /norestart 2. The program's own QuietUninstallString, if it has one 3. Inno Setup uninstallers: /VERYSILENT /SUPPRESSMSGBOXES /NORESTART 4. The UninstallString plus your -ExtraArguments (for example /S) If none of these apply the program is skipped, because running an uninstaller that shows a window would hang when run as SYSTEM.

Report mode (default) lists every match and the exact command it would run. Remove mode runs the commands one by one, waits up to -TimeoutMinutes for each, and checks the registry again afterwards. As a safety net nothing is removed if more than -MaxMatches programs match. Runs silently as SYSTEM from any RMM or Intune. No prompts, no user interaction.

Requirements

Windows PowerShell 5.1+, run as SYSTEM or local admin

How to run it

  • Run as: SYSTEM or a local administrator
  • Run from: any RMM or MDM, Intune, a Group Policy startup script, a scheduled task, or an elevated PowerShell window
  • Script type: PowerShell, 64-bit
  • User interaction: none; the script never prompts
  • Timeout: 10 minutes (30 for Windows Update installs)

Settings

NameWhat it doesOptionsDefault
ModeReport (default) = read-only. Remove = uninstall the matches.Report, RemoveReport
DisplayNameDisplay name pattern as shown in Apps and Features. Wildcards allowed. Examples: 'Zoom*', '*Java 8*', 'Adobe Acrobat Reader*'.required
PublisherOptional publisher pattern, for example 'Oracle*'. Empty = any publisher.
ExcludeNameDisplay name patterns that are never removed, for example '*Update Helper*'.(none)
ExtraArgumentsSilent switches added to a plain UninstallString when no better method is known. Example: /S or --silent. Not used for MSI products.
TimeoutMinutesMinutes to wait for each uninstaller before moving on. Default 15.15
MaxMatchesSafety limit. If more programs match, nothing is removed. Default 5.5

Exit codes

  • 0 = Nothing matched, or all matches removed (reboot may be needed, see log)
  • 1 = Matches found (Report), or some could not be removed or were skipped
  • 2 = Script error

Testing steps

  1. Run it first with the mode set to Report on one test device. Nothing is changed in that mode.
  2. Read the log and confirm the planned changes are what you expect.
  3. Run your chosen settings on the same test target and confirm the result.
  4. Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
  5. Roll out to a small group next, then everyone.

Rollback steps

Uninstalls cannot be undone by the script. Reinstall the program from its installer or your software deployment tool. The log lists the exact name and version that was removed.

Version and change log

VersionDateChanges
1.0.0November 2026First release.