Posted on 12-04-2015 11:31 AM
Hey all,
I'm just starting to familiarize myself with the API, but I don't know where to start with this.
We're going to be trading ~1200 iPads in the next month. I need to delete the old 1200 from JSS, and I have the serial numbers of the devices that I need to delete.
Is there a way for the API to reference something like a .csv file with serial numbers, then delete those mobile devices from JSS?
Solved! Go to Solution.
Posted on 12-04-2015 02:19 PM
I am not in a position to test this properly. So, please use at your discretion and test it thoroughly before looping through all of the serials. But, this should work... Create a txt file with one serial number per line. Press return or type something one line below the last serial number (the script will omit the last line of the txt file).
I use something similar to image, configure and then delete machines that are not going to be managed.
Best,
-Chris
#!/bin/sh
NUMBERS="/path/to/file.txt"
/bin/cat $NUMBERS | while read SERIAL; do
/usr/bin/curl -X DELETE -u username:password https://your.jss.server:8443/JSSResource/mobiledevices/serialnumber/$SERIAL 2>/dev/null
done
exit 0
Posted on 12-04-2015 02:19 PM
I am not in a position to test this properly. So, please use at your discretion and test it thoroughly before looping through all of the serials. But, this should work... Create a txt file with one serial number per line. Press return or type something one line below the last serial number (the script will omit the last line of the txt file).
I use something similar to image, configure and then delete machines that are not going to be managed.
Best,
-Chris
#!/bin/sh
NUMBERS="/path/to/file.txt"
/bin/cat $NUMBERS | while read SERIAL; do
/usr/bin/curl -X DELETE -u username:password https://your.jss.server:8443/JSSResource/mobiledevices/serialnumber/$SERIAL 2>/dev/null
done
exit 0
Posted on 12-04-2015 02:22 PM
If there are any criteria (Model perhaps?) that you could use to build a device group, you could then delete the entire group of devices at once.
Posted on 01-04-2016 07:11 AM
@techhelprhs I finally had a chance to try this out with some devices we resold, and it worked beautifully! Thank you so much!
Posted on 01-06-2016 06:36 PM
Glad to help!
-Chris