Script to detect apps installed in Mac

Khikoman
New Contributor II

I would like to create a script that will allow us to run and confirm that our core apps like Outlook, Teams and others are installed before we give the machine to our normal users.

Any help is greatly appreciated.

1 ACCEPTED SOLUTION

geoff_widdowson
Contributor II

No need for script, just create a smart group. Use CRITERIA 'Application Title', OPERATOR 'is', VALUE <application name>. Add additinal lines for each application, remembering to set the AND/OR to 'and'

Call is something like 'Core Apps Installed' and any computer that shows in the group has all the software you are checking for.

View solution in original post

6 REPLIES 6

geoff_widdowson
Contributor II

No need for script, just create a smart group. Use CRITERIA 'Application Title', OPERATOR 'is', VALUE <application name>. Add additinal lines for each application, remembering to set the AND/OR to 'and'

Call is something like 'Core Apps Installed' and any computer that shows in the group has all the software you are checking for.

thanks Geoff. I have the smart group created for this but the thing is that the engineers who has to do the mac manually for the users would like to have something that they can run on the mac itself so that it will indicate that all the core apps are installed after the enrollment.

Set the smart group up to email on membership change, Make sure your Techs will get the email from the Jamf server. They will get an email as devices get added to the smart group.

dan-snelson
Valued Contributor II

mm2270
Legendary Contributor III

Sounds like you're looking for a way for techs to validate the Mac post setup. While this could be scripted, and it's probably something I would do, what I'd consider is creating the Smart Group like explained above, and then scoping that group to a simple policy in Jamf Pro that is set to Self Service. The policy doesn't have to do much of anything. But the simple fact that it would be scoped to any Macs that fall into that Smart Computer Group would mean the techs would simply look for that policy in Self Service to confirm if the device is ready. If it's not showing up, then it's missing something.

The downside to this approach is they may not know what's missing without doing some examination of the machine. A scripted approach could do something like check for a list of installed applications or tools, and any that are not present can be dropped into a list that displays at the end in a dialog, showing them what's missing. You won't get that level of detail with the Smart Group / Self Service policy approach.

JevermannNG
Contributor II

This is a part of the Enrollment Script that I use for our Service Desk stuff. It ensures that the required MS Office Apps from the Mac App Store are installed before we continue the Enrollment Process.

You could put this one into the Self Service and define the required Application (f4, f5 ...), it runs in a while loop and refreshes every 30s, once all Applications have been found, it will show a final message window and continue or exit the bash script:

 

#!/bin/bash

#####################################################
# Disable Energy Settings                          ##
#####################################################
/usr/bin/caffeinate &
echo "### Caffeinate executed #####"
sleep 2

###############################################
# jamfHelper - Configuration                 ##
###############################################
JHpath="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
# JHicon= ---Path to your PNG Logo---
JHtitle="Self Service Info"


######################################
# Find & Wait for required Apps     ##
######################################
f4=/Applications/Microsoft\ Excel.app
#echo f4 = $f4
f5=/Applications/Microsoft\ Outlook.app
#echo f5 = $f5
f6=/Applications/Microsoft\ PowerPoint.app
#echo f6 = $f6
f7=/Applications/Microsoft\ Teams\ classic.app
#echo f7= $f7
f8=/Applications/Microsoft\ Word.app
#echo f8 = $f8
f9=/Applications/Microsoft\ OneNote.app
#echo f9 = $f9
f10=/Applications/OneDrive.app
#echo f10 = $f10


######################################
# Looking for all required Apps		##
######################################
echo "###"
echo "Run While Loop for Required Apps is running - Start"
echo "#####"
sleep 2

while ! [[ -d $f4 && -d $f5 && -d $f6 && -d $f7 && -d $f8 && -d $f9 && -d $f10 ]]
do
	dt=$(date '+%d.%m.%Y %H:%M:%S')
    echo "### Files Not found - $dt #####"
    userChoice=$( "$JHpath" -windowType utility -title "$JHtitle" -icon "$JHicon" -timeout 30 -description "Some Microsoft Office Apps
are still beeing downloaded!

Please stay tuned...

Press CMD + Q to Jump to next Step" )
	dt=$(date '+%d.%m.%Y %H:%M:%S')
	echo "### userChoice - $userChoice - $dt #####"
	if [ "$userChoice" == "239" ]; then
		break
		echo "### break #####"		
	elif [ "$userChoice" == "243" ]; then
 		sleep 2
 		echo "### sleep 2s #####"
	fi
done


echo "###"
echo "Found All Required MS Office Apps - End"
echo "#####"
sleep 2


##############################################
# Display Dialog to User: Installed Apps	 #
##############################################
echo "###"
echo "Display Message to User - All MS Office Apps Found"
echo "#####"
sleep 2

"$JHpath" -windowType utility -title "$JHtitle" -icon "$JHicon" -button1 "OK" -description "The following Apps have been downloaded and installed:

$f4 
$f5
$f6
$f7
$f8
$f9
$f10

Please click OK to continue." 
sleep 2