How to automatically reinstall software

niacobelli
New Contributor III

Hello,

We are trying to push out a web and application filter for our Middle School students. Because each student is an admin on their computer, they can easily uninstall the software. If I place the packages in a hidden folder, is there a script that can check if the application is installed and if not install it from the hidden directory?

Thanks,
Nick

6 REPLIES 6

jbmaruh
New Contributor III

You can have an extension attribute to look for the application/required files and create a smart group to include machines that come back with an uninstalled response. Then scope a policy as ongoing with the target set to that smart group. Any machine that inventories and is in that smart group would then receive the policy.

danshaw
Contributor II

I've started relying heavily on EA for situations like this. Here is a small EA that detects if a folder exists. If you want to search for a file you can use the "-e" flag instead of "-d".

#!/bin/sh

if
[ -d "/Applications/Application Support/Cisco" ] 
then
echo "<result>Installed</result>"
else
echo "<result>Not Installed</result>"
fi

mm2270
Legendary Contributor III

Why use an EA for something like this when the JSS already captures application inventory? I don't understand the reasoning behind an EA, especially since that EA would only get updated on a full inventory collection, same as the regular application inventory it already captures.

danshaw
Contributor II

@mm2270 I just provided this as an option. I use an EA like this if I am looking for a specific file or folder that is outside of the Applications folder. But you are right, if its an application then just use the JSS inventory. Much easier.

mm2270
Legendary Contributor III

@danshaw Sure thing. I love EAs in general and they are great options for non-standard captured items, or when you need the information in a format the JSS doesn't provide. But yes, for something like a regular app, I would go with using the built in captured data to reduce any overhead during recons.

philburk
New Contributor III

I would first create a Smart Group with Application Name [LIKE] "application name". Then create a Policy to install the application and scope it to "All Managed Clients" and add the Smart Group to the Exceptions. This will install the application on clients that do not have the app. Make sure to update inventory after installation otherwise the policy will run until your next inventory is complete.