I am fairly new in scripting and I am having trouble modifying a script that will successfully change the status tag of computers in a certain smart group.
The status tag which is in the General and you have multiple drop down option (like Active, Retired, disposable, etc) options is created in EA.
I can manually change it by going in the computer in general press edit and from the Status drop menu select what is the new status. I need to make the script do this for me.
#!/bin/bash
# ——————————— Changes Site ———————————
apiURL="https://domain.jamfcloud.com"
apiUser="user"
apiPass="password"
newStatus="Disposed"
# ——————————— Getting the serial ———————————
computerserial="$(system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print $NF}')"
#Change the Site
echo "<computer><general><status><value>$newStatus</value></status></general></computer>" | curl -X PUT -fku $apiUser:$apiPass -d @- $apiURL/JSSResource/computers/serialnumber/$computerserial/subset/general -H "Content-Type: application/xml"
This doesn't work, I did try few variations but it seems I am missing something but I don't know what.