Hi Jamf users,
I'm facing an odd and recurring issue with random users, from time to time the enrollment break and the end users is no longer received updates, use the Self Service and son on. We have to re-enroll the computer using : jamf enroll -prompt
So I was thinking of making a small shell script running everyday on computer checking if the commande jamf policy returns the error Device Signature Error and if "yes" starting JamfHelper and displaying a message to contact the IT.
My script is the following :
#!/bin/bash
output=$(jamf policy 2>&1)
if [[ $output =~ "Device Signature Error" ]]; then
/Library/Application\\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -description "Please contact IT immediatly"
else
exit 0
fi
Then I've written a LaunchDaemon : com.pretendo.JCE.plist to start at login and run it every 2 hours :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>JCE_tool</string>
<key>Program</key>
<string>/Library/Scripts_Rep/jamf_check_enroll.sh</string>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>7200</integer>
</dict>
</plist>
and finally a Script that set the right "after" pushing the script and plot via a policy :
#!/bin/bash
chmod 644 /Library/LaunchDaemons/com.pretendo.JCE.plist
chown root:wheel /Library/LaunchDaemons/com.pretendo.JCE.plist
chmod +x /Library/Scripts_Rep/jamf_check_enroll.sh
launchctl load /Library/LaunchDaemons/com.pretendo.JCE.plist
If I'm here looking for help, as you can easily guess, it's not working. I'll happily get some help to make it work
.