How to uninstall software from Bigfix action script

this is a copy of a task I have for the Splunk Forwarder, I just put in your client name. It creates a batch file and logs the commands issued and results.

Relevance:
exists key whose (value "displayname" of it as string contains "Symantec Netbackup Client" of it and value "uninstallstring" of it as string as lowercase contains "msiexec") of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry

Action Script:

// Log setup
parameter "mainSWDLogFolder" = "{parent folder of client folder of current site}/__Global/SWDDeployData"
folder create "{parameter "mainSWDLogFolder"}"
parameter "logFile" = "SWD_DeploymentResults.log"

parameter "logFolder" = "{parameter "mainSWDLogFolder"}"

delete __createfile
createfile until __END__
echo %DATE% %TIME% >> "{parameter "logFolder"}/{parameter "logFile"}"
echo Action ID: {id of active action} >> "{parameter "logFolder"}/{parameter "logFile"}"
echo command: msiexec.exe /X {name of key whose (value "displayname" of it as string contains "Symantec Netbackup Client" of it and value "uninstallstring" of it as string as lowercase contains "msiexec") of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry} /S >> "{parameter "logFolder"}/{parameter "logFile"}"
set errorlevel=
msiexec.exe /X {name of key whose (value "displayname" of it as string contains "Symantec Netbackup Client" of it and value "uninstallstring" of it as string as lowercase contains "msiexec") of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry} /S >> "{parameter "logFolder"}/{parameter "logFile"}" 2>&1
set SWDExitCode=%errorlevel%
echo Return code: %SWDExitCode% >> "{parameter "logFolder"}/{parameter "logFile"}"
echo. >> "{parameter "logFolder"}/{parameter "logFile"}"
exit %SWDExitCode%
__END__
delete uninstall.bat
move __createfile uninstall.bat
waithidden uninstall.bat >> uninstall.log 2>&1

As trn said, you really should be using the Fixlet Debugger to make sure you’re issuing the correct commands and substitutions. Once you get the hang of it, you’ll be able to use it for all kinds of future tasks.

1 Like

Hi Team i want to uninstall any desk so can any one confirm the command ?

Hi, I have use the below code in Relevance
exists keys whose (name of it starts with “{” and value “DisplayName” of it as string = “iTunes”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of native registry

Action Script:
action uses wow64 redirection false
waithidden “{pathname of system folder}\msiexec.exe” /x{name of key whose (value “DisplayName” of it as string = “iTunes” and name of it starts with “{”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of native registry} /quiet /norestart //(for not rebooting the endpoint)

But in the endpoint log file, getting command failed.
Any suggestion to fix the issue?