Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mani2care/048d4cc25bcbdbb1f171e96b7cc5ba83 to your computer and use it in GitHub Desktop.
Save mani2care/048d4cc25bcbdbb1f171e96b7cc5ba83 to your computer and use it in GitHub Desktop.
Programmatic method to change a Jamf Pro server's Activation Code via the Classic API.
#!/bin/bash
# server connection information
URL="https://jss.talkingmoose.net:8443"
userName="JSSAPI-Editor"
password="password"
# XML data to upload
THExml="<activation_code>
<organization_name>Talking Moose Industries</organization_name>
<code>V7OV-XDEU-DOBI-UDEU-7DEU-DOUD-QRUD-EGNR</code>
</activation_code>"
# flattened XML
flatXML=$( /usr/bin/xmllint --noblanks - <<< "$THExml" )
# API submission command
/usr/bin/curl "$URL/JSSResource/activationcode" --user "$userName:$passWord" --header "Content-Type: text/xml" --request PUT --data "$flatXML"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment