WIN-025 · Script
Silent Software Uninstall by Name
Finds installed software by display name and, in Remove mode, uninstalls it silently.
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
| Name | What it does | Options | Default |
|---|---|---|---|
| Mode | Report (default) = read-only. Remove = uninstall the matches. | Report, Remove | Report |
| DisplayName | Display name pattern as shown in Apps and Features. Wildcards allowed. Examples: 'Zoom*', '*Java 8*', 'Adobe Acrobat Reader*'. | required | |
| Publisher | Optional publisher pattern, for example 'Oracle*'. Empty = any publisher. | ||
| ExcludeName | Display name patterns that are never removed, for example '*Update Helper*'. | (none) | |
| ExtraArguments | Silent switches added to a plain UninstallString when no better method is known. Example: /S or --silent. Not used for MSI products. | ||
| TimeoutMinutes | Minutes to wait for each uninstaller before moving on. Default 15. | 15 | |
| MaxMatches | Safety 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
- Run it first with the mode set to Report on one test device. Nothing is changed in that mode.
- Read the log and confirm the planned changes are what you expect.
- Run your chosen settings on the same test target and confirm the result.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- 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
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |