Combine multiple if relevance

I have the below repeated 20 times for several version of a software and want to know how to combine them.
I want each of the if versions to be evaluated.

if {exists keys whose( value “DisplayName” of it as string contains “###” AND value “DisplayVersion” of it as string = “##” as string) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of x64 registry}
override wait
hidden=true
completion=job
wait msiexec.exe /x {#####} /qn /norestart /lv "C:\Windows\Temp\uninstall.log"
endif

not sure how to do this

So you want to execute the removal command on each instance found in the Registry?

Could one target computer that runs the ActionScript have multiple versions of the software installed?

If you’re trying to target specific versions rather than everything, you could try something like this.

parameter "keyname1"="{names of keys whose (value "DisplayName" of it as string = "Test" and value "DisplayVersion" of it as string = "1") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"
parameter "keyname2"="{names of keys whose (value "DisplayName" of it as string = "Test" and value "DisplayVersion" of it as string = "2") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"
parameter "keyname3"="{names of keys whose (value "DisplayName" of it as string = "Test" and value "DisplayVersion" of it as string = "3") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"
parameter "keyexists1"="{exists keys whose (value "DisplayName" of it as string = "Test" and value "DisplayVersion" of it as string = "1") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"
parameter "keyexists2"="{exists keys whose (value "DisplayName" of it as string = "Test" and value "DisplayVersion" of it as string = "2") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"
parameter "keyexists3"="{exists keys whose (value "DisplayName" of it as string = "Test" and value "DisplayVersion" of it as string = "3") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)}"
if {parameter "keyexists1"}
waithidden msiexec.exe /X{parameter "keyname1" & " /qn /norestart"}
waithidden cmd.exe /C TIMEOUT /T 30 /nobreak
endif
if {parameter "keyexists2"}
waithidden msiexec.exe /X{parameter "keyname2" & " /qn /norestart"}
waithidden cmd.exe /C TIMEOUT /T 30 /nobreak
endif
if {parameter "keyexists3"}
waithidden msiexec.exe /X{parameter "keyname3" & " /qn /norestart"}
waithidden cmd.exe /C TIMEOUT /T 30 /nobreak
endif

For performance reasons, I would try at a slightly different approach. Using separated registry inspections adds more evaluation time so instead of numerous individual inspections, perhaps consider 1 inspection to pull multiple results. I’ll use 3 apps I have installed as an example……note the evaluation times.

3 separated inspections

Q: (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501" and value "DisplayVersion" of it as string = "12.0.30501.0") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries))
A: {050d4fc8-5d48-4b8f-8972-47c82c46020f}
T: 133.906 ms
I: plural string

Q: (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++  Compilers 2010 Standard - enu - x86" and value "DisplayVersion" of it as string = "10.0.40219") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries))
A: {2F8B731A-5F2D-3EA8-8B25-C3E5E43F4BDB}
T: 113.117 ms
I: plural string

Q: (names of keys whose (value "DisplayName" of it as string = "BigFix Client" and value "DisplayVersion" of it as string = "11.0.0.175") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries))
A: {3F9620B8-2C6C-4E21-BE23-8481DA03318B}
T: 86.602 ms
I: plural string

Joined as a single set of 3 separated inspections

Q: (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501" and value "DisplayVersion" of it as string = "12.0.30501.0") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)) ; (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++  Compilers 2010 Standard - enu - x86" and value "DisplayVersion" of it as string = "10.0.40219") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)) ; (names of keys whose (value "DisplayName" of it as string = "BigFix Client" and value "DisplayVersion" of it as string = "11.0.0.175") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries))
A: {050d4fc8-5d48-4b8f-8972-47c82c46020f}
A: {2F8B731A-5F2D-3EA8-8B25-C3E5E43F4BDB}
A: {3F9620B8-2C6C-4E21-BE23-8481DA03318B}
T: 131.264 ms
I: plural string

As 1 registry inspection to check for the same 3 apps

Q: ((names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501" and value "DisplayVersion" of it as string = "12.0.30501.0") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it)  ; (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++  Compilers 2010 Standard - enu - x86" and value "DisplayVersion" of it as string = "10.0.40219") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it) ; (names of keys whose (value "DisplayName" of it as string = "BigFix Client" and value "DisplayVersion" of it as string = "11.0.0.175") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it)) of (x32 registries; x64 registries)
A: {050d4fc8-5d48-4b8f-8972-47c82c46020f}
A: {2F8B731A-5F2D-3EA8-8B25-C3E5E43F4BDB}
A: {3F9620B8-2C6C-4E21-BE23-8481DA03318B}
T: 65.828 ms
I: plural string

If you then use that and concatenate the results with a space this could be used as a parameter

Q: concatenation " " of (((names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501" and value "DisplayVersion" of it as string = "12.0.30501.0") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it)  ; (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++  Compilers 2010 Standard - enu - x86" and value "DisplayVersion" of it as string = "10.0.40219") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it) ; (names of keys whose (value "DisplayName" of it as string = "BigFix Client" and value "DisplayVersion" of it as string = "11.0.0.175") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it)) of (x32 registries; x64 registries))
A: {050d4fc8-5d48-4b8f-8972-47c82c46020f} {2F8B731A-5F2D-3EA8-8B25-C3E5E43F4BDB} {3F9620B8-2C6C-4E21-BE23-8481DA03318B}
T: 66.224 ms
I: singular string

As an action command, this can be sent to a CMD “for” loop so each GUID is passed to msiexec.exe /x to run an uninstall for as many GUIDs where detected, so for building the GUID list and running an uninstall for each

parameter "GUIDS" = {concatenation " " of (((names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++ 2013 Redistributable (x64) - 12.0.30501" and value "DisplayVersion" of it as string = "12.0.30501.0") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it)  ; (names of keys whose (value "DisplayName" of it as string = "Microsoft Visual C++  Compilers 2010 Standard - enu - x86" and value "DisplayVersion" of it as string = "10.0.40219") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it) ; (names of keys whose (value "DisplayName" of it as string = "BigFix Client" and value "DisplayVersion" of it as string = "11.0.0.175") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of it)) of (x32 registries; x64 registries))}
waithidden cmd.exe /c "for %a in ({parameter "GUIDS"}) do (echo msiexec.exe /x %a /qn)" 

While testing in the FixletDebugger you could change the action to a wait command and use cmd.exe /k so you can see the CMD prompt output as it runs. Same method I exampled in Remove CyberArk Agent. This might be a bit more efficient than 20 or so separated inspections and separated uninstalls.

7 Likes