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)

A screen shot of the NInjaOne scripting editor with a simple script for uninstalling Heimdal. Language is set to Batch, Operating System to Windows, Architecture to All and Run As is set to System. There are no additional parameters.

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.

The NinjaOne condition actions dialogue. The automation has been set to the uninstall Heimdal script. Severity has been set to moderate. Priority has been set to High. Auto-Reset has been set to "When no longer met" Ticketing Rule has been set to "Create with Default"

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:

The NinjaOne compound condition "add condition" dialogue. Software name is set to "Huntress Agent" Trigger when is set to "Any Software" and "Doesn't Exist"

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

The NInjaOne Edit a compound condition dialogue. Two conditions have been set to trigger when both "Huntress doesn't exist" and "Heimdal doesn't exist" are set to true.

On the Automations tab, add your Huntress install script.

The NinjaOne edit a compound condition dialogue, showing the automation tab with the Huntress Install script selected.

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.

The NinjaOne Edit a compound condition dialogue, showing the settings tab. Name has been set to "Heimdal uninstalled, Huntress not installed yet" Auto-reset has been set to both "After 1 hour" and "When no longer met" The compund condition has been set to run every 30 minutes

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.

The NinjaOne Edit a compound condition dialogue showing the notifications tab. Severity is set to "Moderate". Priority is set to "High" Ticketing Rule is set to "Create with Default"

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.

 

Leave a Reply

Your email address will not be published. Required fields are marked *