I am new to Action scripts and attempting to create an Uninstall for Active Client software. I am attempting to mimic a popular Winscp uninstall action script because I need to uninstall multiple versions of the software. The problem is that although the software is there, it keeps coming up false in the Fixlet Debugger when searching for the app and uninstall string. Once that happens the uninstall does not take place. Here is what I am using. Any help would be greatly appreciated.
parameter “app”=“Active Client”
//first retrieve our uninstall command…
parameter “QuietUninstallString”="{if (exists x64 registry) AND (exists key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x64 registry) AND (exists value “QuietUninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x64 registry) then ((value “QuietUninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x64 registry as string)) else if (exists key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x32 registry) AND (exists value “QuietUninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x32 registry) then ((value “QuietUninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x32 registry as string)) else “”}“
parameter “UninstallString”=”{if (exists x64 registry) AND (exists key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x64 registry) AND (exists value “UninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x64 registry) then ((value “UninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x64 registry as string)) else if (exists key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x32 registry) AND (exists value “UninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x32 registry) then ((value “UninstallString” whose (it as string != “”) of key (concatenation of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”;(parameter “app” as string))) of x32 registry as string)) else “”}"
continue if {(parameter “UninstallString” != “”) OR (parameter “QuietUninstallString” != “”)}
if {parameter “QuietUninstallString” != “”}
if {parameter “QuietUninstallString” as lowercase contains “msiexec.exe”}
waithidden msiexec.exe /x {parameter “app” as string} /quiet
else
waithidden {parameter “QuietUninstallString”}
endif
else
if {parameter “UninstallString” != “”}
if {parameter “UninstallString” as lowercase contains “msiexec.exe”}
waithidden msiexec.exe /x {parameter “app” as string} /quiet
else
waithidden {parameter “UninstallString”} /quiet /norestart
endif
endif
endif
I’m having a hard time understanding the original intention of your script so im going to ask some questions and we can walk through making something like this. It looks like you’ve got a template that does a lot of stuff but you probably only need to do one thing.
It looks like you are trying to spot a program called, “Active Client” and then uninstall it.
If you look in the registry for this application does it have an uninstall string or a quietuninstallstring? What is the value of the UninstallString or the QuietUninstallString?
Is the path in the registry really HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Active Client or is Active Client just the DisplayName in the registry key and the path is something like HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{123123123-123123123-123123123-12312313}?
First. Thanks for taking time to help. You asked very good questions and are correct on most of your assumptions.
-Yes you are correct this is a template I found.
-Yes, My intention is to uninstall multiple versions of an Application called “Active Client” using its own Uninstall string.
When I look in the registry the path is actually HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall{86E45973-5352-439F-A115-2E8EE4D40140}\ and “Active Client” is the display name in the registry key.
The actual uninstall string in the uninstallKey looks like this “MsiExec.exe /I{86E45973-5352-439F-A115-2E8EE4D40140}”
My assumption was that the template script was searching the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall path for anything containing “Active Client”. Was that incorrect?
Which isn’t what we want because there is no key called active client, it’s always going to be a GUID.
Relevance
I think you did a good job identifying the goal state here. We don’t want to uninstall based on the GUID but instead we want to search for applications with a display name of Active Client and uninstall them. To do that we can use the following relevance:
exists values "DisplayName" whose (it is "Active Client") of keys of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)
Essentially this boils down to:
Check both x86 and x64 registries: (x32 registries; x64 registries)
Look in the uninstall path keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
Loop through all the keys in uninstall keys of keys ...
Find one that has a DisplayName of Active Client values "DisplayName" whose (it is "Active Client")
Did we find one? exists ...
ActionScript
For our uninstall command (our actionscript) we can do a neat trick because that uninstallstring is just Msiexec /i {GUID}
waithidden msiexec /x {names of keys whose (value "DisplayName" of it is "Active Client") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)} /qn
Because the name of they key is normally the GUID, we can just take the name of the key and pass it to msiexec instead of trying to tear apart that uninstall string and replace the /I with a /X.
Please follow-up if you have any questions about this! We changed a lot and knowing how it all works will make future endeavors much easier
** edit - Fixed the missing “CurrentVersion” in the registry path. And a bunch of ActivClient spellings.
ActivClient is a package for dealing with Smart Cards / caching certificates / etc.
It usually also comes with a middleware, like DSI or something. Do you need that removed as well?
What Relevance are you using in your Fixlet?
Since ActivClient is an MSI package, you can take a lot of liberties / logic shortcuts with it. For instance, the name of the Uninstall registry key containing ActivClient is going to be a GUID, the GUID matches the MSI ProductCode, and with the ProductCode we can run the MSI uninstall. note all the versions of ActivClient that I’ve seen are MSI packages. If you come across some versions that are not MSI, some of these shortcuts/assumptions will fail.
One thing you may trip on is that ActivClient is a native (ie 64-bit) application, while the BigFix Client itself is 32-bit. You have to make a couple of considerations, like querying native registry in the Relevance and disabling 32-bit redirection in the Action Script.
Here’s a shot from the cuff, take it with a grain of salt. If it doesn’t work for you let me know and I’ll try to retrieve something more precise at work tomorrow.
Relevance: windows of operating system AND if exists property "in proxy agent context" then not in proxy agent context else true AND exists keys whose (value "DisplayName" of it as string starts with "ActivClient") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of native registry
Action Script:
action uses wow64 redirection false
delete __appendfile
// Build a list of uninstall commands, and concatenate them together with the CR/LF codes to them on separate lines
appendfile {concatenation "%0d%0a" of ("msiexec.exe /x" & it & " /qn REBOOT=ReallySuppress") of names of keys whose (value "DisplayName" of it as string starts with "ActivClient") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of native registry
delete RemovePackages.cmd
move __appendfile RemovePackages.cmd
waithidden cmd /c RemovePackages.cmd
action may require reboot
Hello @Strawgate, and @JasonWalker A thank you is long over due. Thanks for pointing out why my first attempt failed, creating the correct script and breaking it down. It really helped the way you explained each step. @JasonWalker thanks for your input as well. I like the idea of using the appendfile command to create, move, and install the software package. I am testing the two methods as we speak to see which works best for my environment.
Thank you both. I will keep you posted.