Anyone got an EA that reports back the management account used?
Or a way to smart group machines based on management account?
Anyone got an EA that reports back the management account used?
Or a way to smart group machines based on management account?
Best answer by mm2270
Yep.
But... the only way (currently) is to use the Casper API. The information exists in the API for every Mac, but can't be accessed any other way.
So first things first is to set up a 'read-only' API account on your JSS if you haven't done so already. Then plug that info along with your JSS address into the below script
#!/bin/sh
apiURL="https://your.casper.jss:8443/JSSResource/computers/macaddress/"
apiUser="apiusername"
apiPass="apipassword"
MacAdd=$( networksetup -getmacaddress en0 | awk '{ print $3 }' | sed 's/:/./g' )
ManAccount=$( curl -s -u $apiUser:$apiPass "$apiURL$MacAdd" | xpath /computer/general/remote_management/management_username[1] | sed 's/<management_username>//;s/</management_username>//' )
if [[ "$ManAccount" != "" ]]; then
echo "<result>$ManAccount</result>"
else
exit 0
fi
In case you're wondering why the if/then, exit stuff, our JSS is clustered with a limited access server in the DMZ so Macs can connect in outside the network. problem is, the API uses Tomcat which is disabled on the external server (Limited Access JSS) so we had some issues early on where if it couldn't read the information back during inventory while outside, it would blank out the value previously assigned. Since we had a policy that was attempting to correct the management account with a QuickAdd.pkg, it was causing those Macs to be re-enrolled. Not what we wanted and caused a few issues, like some policies re-running.
Truth is though, I'm not sure if the if/then, else exit is actually working as EA's operate a bit differently than regular scripts. Our account rep at JAMF thinks they must upload 'something' regardless of how you designed the script, and I have a feeling that is the case. We had disabled the above referenced policy anyway for other reasons.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.