Posted on 12-03-2020 03:50 PM
Posted on 12-03-2020 11:09 PM
Something along these lines perhaps? Not tested, but it should work or just need some tweaks.
You will need to of course update the relevant bits like the API username/password and the correct URL. If these are computer groups and not mobile ones, then use computergroups
instead of mobiledevicegroups
#!/bin/sh
user="username"
pass="password"
url="https://your.jamfserver.com/JSSResource/mobiledevicegroups/id"
group_ids=(1 3 5 10 12 13 18 20 21 28 35). ## Put all IDs in this array separated by spaces
for ID in "${group_ids[@]}"; do
echo "Now deleting group id: ${ID}"
/usr/bin/curl -u "${user}:${pass}" "${url}/${ID}" -X DELETE
done
Alternatively, if the group IDs are all in a file somewhere, you could point the script to that file to read them in instead and loop over each one to delete them.