Has anyone successfully deployed the following script to add a computer to a static group. Goal: Have buttons in Self Service to add a computer to a static group.
$4 is the group ID.
#!/bin/sh
#API login info
apiuser="apiaccount"
apipass='apiaccountpassword'
jamfProURL="https://myjamfinstance.jamfcloud.com"
ComputerName=$(hostname)
#Group to update
GroupID="$4"
apiURL="JSSResource/computergroups/id/${GroupID}"
#XML header stuff
xmlHeader="<?xml version="1.0" encoding="UTF-8" standalone="no"?>"
apiData="<computer_group><id>${GroupID}</id><name>Whatever the GroupName Is</name><computer_additions><computer><name>$ComputerName</name></computer></computer_additions></computer_group>"
curl -sSkiu ${apiuser}:${apipass} "${jamfProURL}/${apiURL}"
-H "Content-Type: text/xml"
-d "${xmlHeader}${apiData}"
-X PUT > /dev/null