Uninstall Software (Machine-Wide)
Log In or Register to download the BES file, and more.

0 Votes

Description

This task uninstalls a Windows application based on a partial application name provided by the administrator at action time. The task searches for the specified application and executes its registered uninstall command.

Important: This task applies only to applications that are installed system-wide (machine-level installations), typically registered under Programs and Features and installed in C:\Program Files or C:\Program Files (x86).

Applications that were installed per user (user-context installations) are not covered by this task. Such applications are usually installed under %LOCALAPPDATA% or %APPDATA% and register their uninstall information under the user’s registry hive. These applications require a different uninstall approach.


Property Details

ID27403
StatusQA - Ready for Production Level Testing
TitleUninstall Software (Machine-Wide)
DomainBESC
SourceInternal
Source Release Date12/11/2025 12:00:00 AM
KeywordsUninstall, Software, Remove, Application, Installed
Added by on 1/23/2026 4:40:59 AM
Last Modified by on 1/23/2026 4:40:59 AM
Counters 196 Views / 0 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 0 ratings. ** Log In or Register to add your rating.

Relevance

Used in 1 fixlet   * Results in a true/false
Show indented relevance
/* Windows-only fixlet - applicability is handled at action time */ windows of operating system

Actions

Action 1 (default)

Action Link Click here to deploy this action.
Script Type BigFix Action Script
// Ask operator for the application name (substring) as shown in Programs and Features
action parameter query "AppName" with description "Enter part of the application's DisplayName as shown in Programs and Features:"
pause while {not exists parameter "AppName"}
parameter "AppNameLower" = "{parameter "AppName" as lowercase}"

// Default values

// If found in 64-bit node, capture UninstallString, DisplayName
if {exists keys whose (exists value "DisplayName" of it AND (value "DisplayName" of it as string as lowercase contains parameter "AppNameLower") AND (exists value "UninstallString" of it)) of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of native registry}
    parameter "UninstallCmd64" = {value "UninstallString" of it of keys whose (exists value "DisplayName" of it AND (value "DisplayName" of it as string as lowercase contains parameter "AppNameLower") AND (exists value "UninstallString" of it)) of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of native registry}
    parameter "AppDisplayName64" = "{value "DisplayName" of it of keys whose (exists value "DisplayName" of it AND (value "DisplayName" of it as string as lowercase contains parameter "AppNameLower") AND (exists value "UninstallString" of it)) of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of native registry}"
else
parameter "UninstallCmd64" = "non-existing"
parameter "AppDisplayName64" = "non-existing"
endif

// If found in 32-bit node, capture UninstallString, DisplayName
if {exists keys whose (exists value "DisplayName" of it AND (value "DisplayName" of it as string as lowercase contains parameter "AppNameLower") AND exists value "UninstallString" of it) of keys "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" of native registry}
parameter "UninstallCmd32" = value "UninstallString" of it of keys whose (exists value "DisplayName" of it AND (value "DisplayName" of it as string as lowercase contains parameter "AppNameLower") AND exists value "UninstallString" of it) of keys "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" of native registry
parameter "AppDisplayName32" = value "DisplayName" of it of keys whose (exists value "DisplayName" of it AND (value "DisplayName" of it as string as lowercase contains parameter "AppNameLower") AND exists value "UninstallString" of it) of keys "HKLM\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" of native registry
else
    parameter "UninstallCmd32" = "non-existing"
    parameter "AppDisplayName32" = "non-existing"
endif

// Ensure we found at least one uninstall string
continue if {(parameter "UninstallCmd64" != "non-existing") OR (parameter "UninstallCmd32" != "non-existing")}

// Execute uninstall(s) with /S (you requested /S always)
if {parameter "UninstallCmd64" != "non-existing"}
waithidden cmd.exe /C ""{parameter "UninstallCmd64"}" /S"
// Append to BES Client uninstall log (always append)
    delete __appendfile
    appendfile {now as string} - {computer name} - Uninstalled: "{parameter "AppDisplayName64"}"
    waithidden cmd.exe /C type "__appendfile" >> "{pathname of parent folder of client}\uninstalledSW.log"
    delete __appendfile

endif

if {parameter "UninstallCmd32" != "non-existing"}
waithidden cmd.exe /C ""{parameter "UninstallCmd32"}" /S"
// Append to BES Client uninstall log (always append)
    delete __appendfile
    appendfile {now as string} - {computer name} - Uninstalled: "{parameter "AppDisplayName32"}"
    waithidden cmd.exe /C type "__appendfile" >> "{pathname of parent folder of client}\uninstalledSW.log"
    delete __appendfile

endif
Success Criteria

This action will be considered successful when all lines of the action script have completed successfully.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!