Sometimes your organisation may wish to change one piece of software for another one, however they can’t be installed at the same time because of the possibility of conflicts. The first example of this that immediately jumps in to your mind would be security software. We can manage this using NinjaOne with regular conditions and the new compound conditions to uninstall the original software, and then once this is done, install the new software.
I’ll be using Heimdal and Huntress as examples as their uninstall scripts are publicly available.
Creating a condition to uninstall Heimdal
Uninstalling Heimdal is pretty simple. If you have multiple versions in your estate the uninstall script can be found here, or if you’ve just the one version on your estate, you can simply use MSIEXEC with the product code (4.5.1 is MsiExec.exe /X {E7680D59-6C52-4163-8BE3-0DC392A2E6E1} /qn for example).
In NinjaOne, navigate to Administration > Automation and add a new script. It should look something like this (with your chosen script)

Once you have saved your script, you will need to create a condition to uninstall Heimdal.
In NinjaOne, head on over to the policy that you need this condition to run on and create a new condition.
You need to be creating a new software condition, and presence will be set to “exists” and the names section to (I will use my example) “Heimdal Thor Agent (4.5.1)”

Next you’ll need to configure the tasks to be actioned when the condition is met.
Under automations, choose your Heimdal uninstall script. I’ve not given the condition a name as the default one is fine for my needs.
Set your priority and severity according to your needs. I have set auto-reset to “when no longer met” as I would like to know when the script has not successfully run, as this is an indicator this machine needs a manual intervention. I’ve set the ticketing rule to create with default for the same reason. Set yours up as best suits your needs.

So now you’ve set your policy to automatically uninstall Heimdal when it is installed, how do you configure Ninja to wait for the uninstall to happen, and then go and install Huntress?
Creating a compound condition to install Huntress once Heimdal has been uninstalled.
I’m not going to go into detail on how to create your Huntress install script, Huntress have a great step-by-step guide on their support pages.
Get that put into NinjaOne and then head over to your policy and select the Compound Conditions tab. Click on +Add.
Firstly, you are going to need to tell Ninja to trigger this condition only when both Heimdal AND Huntress are not installed on the machine.
You’ll do this by setting the “Trigger when” drop down to “All conditions are true”, then click on +add condition and create two software conditions, one for Heimdal and one for Huntress with a trigger of “Any software” and “Doesn’t Exist” as below:

Once you’ve set them both up, it will look something like the below image:

On the Automations tab, add your Huntress install script.

Next you’ll need to set up the settings for the compound condition. I’ve called mine simply “Heimdal uninstalled, Huntress not installed yet”.
Auto-Reset I have set to both “When no longer met” and “After 1 hour”. I did this because I was finding that when users weren’t rebooting their machines, if the Huntress install script had failed for some reason (for instance something had blocked it) then this allows the script to run automatically once you have resolved the blocker.
The compound condition detection runs every 30 mins initially, although I may increase this later.

You can set up the notifications tab as reflects the needs of your organisation. I’ve set severity to “Moderate”, Priority to “High” and set the ticketing rule to “Create with Default”. This gives me some extra visibility to machines that might be having problems and require an intervention.

Once you’ve got this, click apply and then save out of the policy and sit back and wait for Ninja to work its magic.
I’ve found that this runs pretty smoothly in my environment, and it has the added bonus of installing Huntress on new users machines when they are setting up pretty quickly.
I hope you find this guide useful.