Take a look at the xpath parts on the EA. its only setup to work on older OS. If you look at the xpath on the script that uploads the logs, you can see the difference in xpath scheme for older and newer OS.
hmmm, so the EA code is out of date. I tried change the xpath code from...
xpath '/computer/purchasing/attachments'
to
xpath "//computer/general/id/text()"
but now it just produces "parser error"s.
hmmm, so the EA code is out of date. I tried change the xpath code from...
xpath '/computer/purchasing/attachments'
to
xpath "//computer/general/id/text()"
but now it just produces "parser error"s.
Notice the -e after xpath in OS > 11.
This should work. Replaces lines 10-14 from the original script. (Haven't tested)
osMajor=$(/usr/bin/sw_vers -productVersion | awk -F . '{print $1}')
osMinor=$(/usr/bin/sw_vers -productVersion | awk -F . '{print $2}')
## Determine Jamf Pro Device ID
if [[ "$osMajor" -ge 11 ]]; then
jamfProID=$( curl -k -u $jamfProUser:$jamfProPass $jamfProURL/JSSResource/computers/serialnumber/$mySerial/subset/general | xpath -e "//computer/general/id/text()" )
elif [[ "$osMajor" -eq 10 && "$osMinor" -gt 12 ]]; then
jamfProID=$( curl -k -u $jamfProUser:$jamfProPass $jamfProURL/JSSResource/computers/serialnumber/$mySerial/subset/general | xpath "//computer/general/id/text()" )
fi
## API Lookup for how many attachments are attached to this device record
if [[ "$osMajor" -ge 11 ]]; then
numAttachments=$( curl -u $jamfProUser:$jamfProPass $jamfProURL/JSSResource/computers/id/$jamfProID -X GET | xmllint -format - | xpath -e '/computer/purchasing/attachments' | grep "<id>" | wc -l | xargs )
elif [[ "$osMajor" -eq 10 && "$osMinor" -gt 12 ]]; then
numAttachments=$( curl -u $jamfProUser:$jamfProPass $jamfProURL/JSSResource/computers/id/$jamfProID -X GET | xmllint -format - | xpath '/computer/purchasing/attachments' | grep "<id>" | wc -l | xargs )
fi
That totally worked. I appreciate the assistance.