cancel
Showing results for 
Search instead for 
Did you mean: 
Disclaimer
JUMPCLOUD EXPRESSLY DISCLAIMS ALL REPRESENTATIONS, WARRANTIES, CONDITIONS, AND LIABILITIES OF ANY KIND ARISING FROM OR RELATED TO THIRD-PARTY SOFTWARE, SCRIPTS, REPOSITORIES, AND APIS. JUMPCLOUD IS NOT REQUIRED TO SUPPORT ANY SUCH THIRD-PARTY MATERIALS AND ALL RISKS RELATED TO THIRD-PARTY MATERIALS ARE YOUR RESPONSIBILITY. PLEASE ALSO REVIEW THE JUMPCLOUD TOS.

Install Installomator app if user in department - Mac

Fulgubbe
Novitiate III

Wrote this quick one today to be used in our enrolment script. I checks if a user is bound to a specific departement and run a Installomator app install based on that. It also checks if app already are installed. In the example we install Adobe Creative cloud desktop to users in Marketing.

#!/bin/bash

#########################################################################################################

JCAPIKey='YOUR API KEY'
department="Marketing" #If users are in this departement app will install
installomatorapp="adobecreativeclouddesktop" #Installomator install name
installedappdir="/Applications/Utilities/Adobe Creative Cloud/" #Directory to check if app is installed

#########################################################################################################

#Check local username
username="$(cat /opt/jc/managedUsers.json | sed -n 's/.*"username":"//p' | awk -F '\\",' '{print ($1)}')" 

#Check if user are in departement
ingroup="$(curl -s -X POST https://console.jumpcloud.com/api/search/systemusers \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: '$JCAPIKey'' \
  -d '{
  "searchFilter": {
    "searchTerm": "$username",
    "fields": ["username"]
  },
  "filter": {
    "or": [
      {"department" : "$department"}
    ]
  },
  "fields" : "username"
}')"

#Crosscheck local user with API call
usercheck="$(echo $ingroup | grep -o "$username")"

#Install if user is in group and App not installed.
if [ ! "$usercheck" == "$username" ]; then
    echo "Not in $department Exiting"
    exit 0
elif [ -d "$installedappdir" ]; then
  	echo "$installomatorapp Already Installed"
  	exit 0
else
	echo "Installing $installomatorapp"
cd /usr/local/Installomator/

./Installomator.sh $installomatorapp

fi

 

 

 

 

0 REPLIES 0
You Might Like

New to the site? Take a look at these additional resources:

Community created scripts:

Our new Radical Admin blog:

Keep up with Product News:

Read our community guidelines

Ready to join us? You can register here.