Uninstall Software from Windows using relevance

Hi All,

I’m trying to uninstall FortiClient from windows OS using below code:


//Node: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
//Product Name: FortiClient Services
//Publisher: FortiClient.

if {exists key whose (value “DisplayName” of it as string = “FortiClient”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry}
waithidden “{pathname of system folder}\msiexec.exe” /x {name of key whose (value “DisplayName” of it as string = “FortiClient” and name of it starts with “{”) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry} /qn
endif

The code is able to uninstall FortiClient from the end-user but the status of the action shows Failed.

Action Script Execution Detail in View action info shows Completion of every line of the code.

Not sure where I’m missing, any help on this would be highly appreciated…!! :relaxed:
Thank You

Hi @prabhu490730

Can you show on which step it fails in the action log? (in the action on the computer, right click, “show action info”). My guess is that it’s given an exit code that is not “0”.

In action info: Every line of the script has been completed successfully.

Ok, can you go to the TASK (so not the action) and, click edit?

And then go to:

Check the checkbox “Include custom success criteria” and click edit next to it:

I think by default it’s “…the applicability relevance evaluates to false”. If your relevance is not changing due to the action, it will says that the action is failed. If you chose “…all lines of the action script have completed successfully”, then it will just look at the action script lines and see if they have run succesfully (or “completed”) or not.

So what is your relevance and what do you want? That the relevance evaluates afterwards and changes or you just want the action to run all the lines?

1 Like

Ahh…!! I just missed that.

I have checked the box for Include custom success criteria and selected the desired option as shown above. There after, I have re-run the task for uninstalling FortiClient from the machine. Now action shows Fixed but now I have verified FortiClient still remains on my machine.

Any Idea on this please…?

Leave the Success Criteria as “applicability relevance evaluates to false”. Otherwise you’re just masking a problem.

This key appears to be in the native (not Wow6432Node) registry, so update both the Relevance and the Action Script accordingly. The BigFix client is a 32-bit application, so you need to query “of native registry” in relevance and use an “action uses wow64 redirection false” in the script.

Also, for debugging, check the client logs which would show the actual text of the ‘waithidden’ command, after performing the Relevance Substitutions; I think you’d find that it gave no result for the registry query.

There also should not be a space between “/x” and the GUID.

Relevance:
exists keys whose (name of it starts with "{" and value "DisplayName" of it as string = "FortiClient") of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry

Action:

action uses wow64 redirection false    
waithidden "{pathname of system folder}\msiexec.exe" /x{name of key whose (value "DisplayName" of it as string = "FortiClient" and name of it starts with "{") of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of native registry} /qn
endif
1 Like

Thank you @JasonWalker for your justification…!!
Now the code works perfectly.

I have created this action as Task now, Earlier it was set as Fixlet which is why action status was showing as Fixed.
Action:

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

endif: I have removed from the action script, as we are not using If clouse in the action.

Thank You!!

1 Like