Skip to content

Instantly share code, notes, and snippets.

@kitzy
Created May 10, 2015 02:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitzy/e1ee9d5f4e43bf184e3e to your computer and use it in GitHub Desktop.
Save kitzy/e1ee9d5f4e43bf184e3e to your computer and use it in GitHub Desktop.
This gist checks to see if JSS enrollment is complete, and attempts to force enrollment until sucessful.
#!/bin/bash
# Check to make sure the machine has enrolled before continuing
/bin/echo "Checking enrollment..."
until [ ! -f "/Library/Application Support/JAMF/FirstRun/Enroll/enroll.sh" ]
do
/bin/echo "Machine is not enrolled. Trying enrollment."
# Attempt enrollment
/Library/Application\ Support/JAMF/FirstRun/Enroll/enroll.sh
# Test if enrollment completed, sleep and try again if not
if [ ! -f "/Library/Application Support/JAMF/FirstRun/Enroll/enroll.sh" ]
then
break
else
sleep 30
fi
done
/bin/echo "Enrollment complete"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment