Skip to main content
Solved

Mass Delete Using Serial Number List?


Forum|alt.badge.img+12
  • Valued Contributor
  • 181 replies

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

Best answer by brad

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

View original
Did this topic help you find an answer to your question?

11 replies

Forum|alt.badge.img+15
  • Contributor
  • 589 replies
  • June 14, 2016

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

Forum|alt.badge.img+15
  • Contributor
  • 67 replies
  • Answer
  • June 15, 2016

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


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • June 15, 2016

@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...


Forum|alt.badge.img+12
  • Author
  • Valued Contributor
  • 181 replies
  • June 20, 2016

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.


Forum|alt.badge.img+14
  • Honored Contributor
  • 862 replies
  • June 21, 2016

That is SWEET! Thanks @brad for posting and JAMF for coding! This will be useful for many things..


Forum|alt.badge.img+5
  • New Contributor
  • 2 replies
  • June 19, 2018

@brad - This just saved me a couple hours. Thank You!


Forum|alt.badge.img+3
  • New Contributor
  • 2 replies
  • August 14, 2018

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.


emily
Forum|alt.badge.img+24
  • Employee
  • 871 replies
  • August 14, 2018

@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.


Forum|alt.badge.img+7
  • Contributor
  • 35 replies
  • September 14, 2018

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)


Forum|alt.badge.img+1
  • New Contributor
  • 7 replies
  • October 1, 2021

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.


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • October 7, 2021

Is there a possibility to wipe computers instead of delete computers in a Smart Group? 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings