Posted on 06-14-2016 01:24 PM
Hello,
We are in the process of selling many of out 8th grade MacBooks to the students. We are marking them sold in our cataloging system and have run the removeframework (along with many other tasks), but we never figured out how to script deleting the device from the JSS. Using our cataloging system I can create a list of serial numbers for the devices to delete. Is there some way to use this list of serial numbers to automate deleting the devices? My quick look didn't reveal anything, but figured I would check.
Thanks,
Tim
Solved! Go to Solution.
Posted on 06-15-2016 12:24 PM
HI @musat,
@thoule has a nice solution there. Another option would be to take your serial numbers and format them to be serial, serial, serial, serial and paste that into the search field. That will list all the devices and then you can do a mass action. This gives you a sanity check of sorts before deleting devices.
I use that method or another method where I add the devices to a group using the API, then do the mass action to delete when ready.
Cheers!
Brad
Posted on 06-14-2016 01:45 PM
Assuming you have a text file with serial numbers such as:
QW123456FED FED2353RB21A ABCDEFG1234
#!/bin/sh
#deletes computers identified by SNs in a text file
username="apiusername"
password="SekretWurdz"
server="https://server.name.com:8443"
computerList=`cat /Users/<yourname>/Desktop/SNsToDelete.txt`
arr=($computerList)
for i in "${arr[@]}"; do
echo "Deleting computer: $i"
curl -H "Accept: application/xml" -sfku "$username:$password" "$server/JSSResource/computers/serialnumber/$i" -X DELETE
done
Posted on 06-15-2016 12:24 PM
HI @musat,
@thoule has a nice solution there. Another option would be to take your serial numbers and format them to be serial, serial, serial, serial and paste that into the search field. That will list all the devices and then you can do a mass action. This gives you a sanity check of sorts before deleting devices.
I use that method or another method where I add the devices to a group using the API, then do the mass action to delete when ready.
Cheers!
Brad
Posted on 06-15-2016 12:36 PM
@brad thanks for your post. That's an amazing hint!! I never knew you could type/paste in multiple serial numbers separated that way and pull them all up at once. How long has that been a feature that I never knew about!? And I see this also works for computer names! Sweet! I wonder what else it works with? Need to go off and experiment now...
Posted on 06-20-2016 07:04 AM
Thanks for the ideas. I wound up using the suggestion from @brad and did a search on serial number. Which wound up being a very good idea. I has a list of 267 serial numbers, and the search turned up 282 computers. Guess I need to do my duplicate hunt again.
Posted on 06-20-2016 05:31 PM
That is SWEET! Thanks @brad for posting and JAMF for coding! This will be useful for many things..
Posted on 06-19-2018 08:28 AM
@brad - This just saved me a couple hours. Thank You!
Posted on 08-14-2018 01:27 PM
Thanks @brad , search serial numbers is great method. However, when we try bulk delete around 150 computers, the action times out, and CPU goes really high. We are using Jamf 10.3.1 on premise. Is this an known issue, or something I did was wrong? Any suggestions? Thanks again.
Posted on 08-14-2018 01:31 PM
@nicole.qu I realize I'm not @brad, but you're running into a PI that is resolved in 10.6.
[PI-004957] Fixed an issue that caused intermittent performance issues when a mass action was used to delete computers.
Posted on 09-14-2018 08:03 AM
I recommend using a Static Group to perform this request. I just deleted 53 mobile devices from our JAMF in less than a couple of minutes. I created a static group with the help of The MUT. You can create one in JAMF too but if you have a list of serial numbers I think it's much easier with The MUT. I then click on the Static Device Group > View > Action > Delete Mobile Devices > Are you sure? > Yes.
Here is a link to the Jamf Pro Administrator's Guide Version 10.5.0 that explains how to create a Static Device Group. I highly recommend making this feature your friend. (https://docs.jamf.com/10.5.0/jamf-pro/administrator-guide/Static_Device_Groups.html)
Posted on 10-01-2021 05:45 AM
I tried to find by pasting many serial numbers separated by a comma and was not able to find any (sorry for being dense). Where exactly did everyone "paste" the serial numbers?
I created a "smart Group" because they all had the same position and I was able to delete 93 ipads that way.
Posted on 10-07-2021 11:04 AM
Is there a possibility to wipe computers instead of delete computers in a Smart Group?