-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathResetMDM.sh
executable file
·31 lines (26 loc) · 1.47 KB
/
ResetMDM.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Replace with the UUID for the MDM profile that is deployed by your JSS
mdmuuid="00000000-0000-0000-A000-4A414D460004"
mdm=$(/usr/bin/profiles -L | grep $mdmuuid)
jamf_binary=`/usr/bin/which jamf`
if [ "$mdm" ]; then
echo "Removing existing MDM profile:"
# This optional method below does not rely upon jamf binary
# /usr/bin/profiles -R -p $mdmuuid -v
$jamf_binary removeMdmProfile -verbose
echo ""
fi
echo "Installing new MDM profile"
$jamf_binary mdm -verbose
status=$?
# You can replaced "Self Service" with another OS X app or service if you prefer
echo ""
if [ $status -ne 0 ]; then
echo "There was an error installing the MDM profile: $status"
/usr/bin/osascript -e 'Tell application "Fox Self Service" to display dialog "There was an error obtaining a new MDM profile.\n\nPlease contact IT for assistance." with title "jamf error" with text buttons {"OK"} default button 1 with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:AlertCautionIcon.icns" giving up after 15'
exit $status
fi
echo "Running Recon"
$jamf_binary recon
/usr/bin/osascript -e 'Tell application "Fox Self Service" to display dialog "Profiles should now be pushed to your Mac.\n\nIf you do not see profiles populating after five minutes contact IT for assistance." with title "Success" with text buttons {"OK"} default button 1 with icon file "System:Library:PreferencePanes:Profiles.prefPane:Contents:Resources:Profiles.icns" giving up after 15'
exit 0