unmanage iOS device

amenard
New Contributor II

If an iPad is turned off when the "unmanage device" command is sent and the device is marked as "unmanaged" will the JSS continue to try to contact the device for 1 day, 30 days or longer to remove all the profiles that came via the Prestage Enrollment and Configuration profiles?

If the command is only sent for a limited time is it recommended that the iPad be turned on at the time of sending the "unmanage device" command?

3 REPLIES 3

GregE
Contributor

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>"

kythan06
New Contributor

Do we have a solution for this yet?

kevin_v
Contributor

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