Uninstall Software (Machine-Wide)
| 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
| 27403 | |
| QA - Ready for Production Level Testing | |
| Uninstall Software (Machine-Wide) | |
| BESC | |
| Internal | |
| 12/11/2025 12:00:00 AM | |
| Uninstall, Software, Remove, Application, Installed | |
| oubari on 1/23/2026 4:40:59 AM | |
| oubari on 1/23/2026 4:40:59 AM | |
| 196 Views / 0 Downloads | |
* Average over 0 ratings.
** Log In or Register to add your rating.
|
Relevance
| Used in 1 fixlet | * Results in a true/false |
Actions
Action 1 (default)
// Ask operator for the application name (substring) as shown in Programs and FeaturesSuccess Criteria
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
This action will be considered successful when all lines of the action script have completed successfully.
Sharing
| Social Media: |

