I'm surprised there aren't more people asking this question, but now that Jamf have removed the "Mark device as Unmanaged" command - what is everyone doing to unmanage offline devices without deleting the device record?
We want to retain historical data of the device (for if/when they are reactivated) but also some devices are sent off to disposal companies before being online and 'unmanaged' in Jamf. Previously we would simply click the 'mark as unmanaged' button in Jamf and that would save us paying the license fee for a device we no longer have.
edit: Jamf support has provided a workaround for this via the API
curl -sku username:password -X PUT -H "content-type: text/xml" "https://instancename.jamfcloud.com/JSSResource/mobiledevices/id/JamfID" -d "<mobile_device><general><managed>false</managed></general></mobile_device>"
Do we have a solution for this yet?
Would anyone care to help me test this script out I've been developing re: unmanaging devices via API?
#!/bin/bash
#Unmanage mobile devices from a CSV file via Jamf API
#Server Information
server="url"
APIusername="username"
APIpassword="password"
CSV="filepath"
# Count entries in CSV
count=`cat ${CSV} | awk -F, '{print NF}'`
# Start the count
index="0"
# Loop through the entries and set unamanged
while [ $index -lt ${count} ]
do
index=$[$index+1]
var=`cat ${file} | awk -F, '{print $'"${index}"'}'`
curl -ksu "$APIusername":"$APIpassword" -H "content-type: application/xml" "$server"/JSSResource/mobiledevices/serialnumber/$var -X PUT -d "<mobile_device><general><managed>false</managed></general></mobile_device>"
done
exit 0