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
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
โ09-18-2023 10:33 AM - edited โ09-18-2023 10:48 AM
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
Labels:
- Labels:
-
Bash
0 REPLIES 0