Posted on 05-12-2022 07:41 AM
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.
Solved! Go to Solution.
Posted on 05-12-2022 11:50 AM
Refer to this thread .it might be helpful
https://community.jamf.com/t5/jamf-pro/setting-an-extension-attribute-using-policy/td-p/239242
Posted on 05-12-2022 01:32 PM
I was checking the error logs and I had 401, weirdly the API account had the appropriate rights assigned but after I selected full rights just to test if that was the reason it managed to change it.
I need to mention I did modify the script to to edit in extension attribute like in the link you provided.
Cheers!
Posted on 05-12-2022 11:50 AM
Refer to this thread .it might be helpful
https://community.jamf.com/t5/jamf-pro/setting-an-extension-attribute-using-policy/td-p/239242
Posted on 05-12-2022 01:32 PM
I was checking the error logs and I had 401, weirdly the API account had the appropriate rights assigned but after I selected full rights just to test if that was the reason it managed to change it.
I need to mention I did modify the script to to edit in extension attribute like in the link you provided.
Cheers!