We are after changing the naming convention for classes imported with ASM. Is there a way to mass delete the classes in there now?
Thanks
We are after changing the naming convention for classes imported with ASM. Is there a way to mass delete the classes in there now?
Thanks
Hi! I'm RPSadmin from above - the new push to jamf id seems to have forced me to create a new account - guess I'll have to figure out how to merge them 🙂
In any event, to answer your questions, you do the following to run the script on a mac
As I mentioned in the first post, just be careful doing this as it will wipe out all your classes in one go.
For some reason, I keep getting
***********
scrowell@SCROWELL-MBP ~ % sudo chmod u+x sudo /Users/scrowell/Desktop/DeleteAllClasses.sh
Password:
Sorry, try again.
*************
Not sure what's going on. My account authenticates to jamf through LDAP so I tried using a standard user in jamf that has admin privileges as well without luck. I first used my account in the SH file and the terminal prompt then I tried using the standard account. Any suggestions?
For some reason, I keep getting
***********
scrowell@SCROWELL-MBP ~ % sudo chmod u+x sudo /Users/scrowell/Desktop/DeleteAllClasses.sh
Password:
Sorry, try again.
*************
Not sure what's going on. My account authenticates to jamf through LDAP so I tried using a standard user in jamf that has admin privileges as well without luck. I first used my account in the SH file and the terminal prompt then I tried using the standard account. Any suggestions?
Makes sense. I did that but accidentally screwed up the command and was prompted for the pwd. Then I did it properly (I think) but got no results. All of the classes are still present.
*********
scrowell@SCROWELL-MBP ~ % sudo chmod u+x sudo /Users/scrowell/Desktop/DeleteAllClasses.sh
Password:
chmod: sudo: No such file or directory
scrowell@SCROWELL-MBP ~ % sudo chmod u+x /Users/scrowell/Desktop/DeleteAllClasses.sh
scrowell@SCROWELL-MBP ~ % sudo chmod u+x /Users/scrowell/Desktop/DeleteAllClasses.sh
scrowell@SCROWELL-MBP ~ %
For anyone finding this thread in the year 2024 -
There was a small typo in my script above which wasn't causing issues before but is now. This is the corrected script:
#!/bin/bash
jssUser="Username"
jssPass="Password"
jssURL="https://yourdomain.jamfcloud.com:443"
echo "Downloading list of class IDs..."
ids+=($(curl -X GET -s -k -u "$jssUser:$jssPass" "$jssURL/JSSResource/classes" | xmllint --format - | awk -F'>|<' '/<id>/{print $3}' | sort -n))
for n in "${ids[@]}"; do
curl -kvu $jssUser:$jssPass ${jssURL}/JSSResource/classes/id/$n -X DELETE
done
Directions on how to implement the script remain the same, however. I'll reprint them here so everything is in one place:
As I mentioned in the first post, just be careful doing this as it will wipe out all your classes in one go.
For anyone finding this thread in the year 2024 -
There was a small typo in my script above which wasn't causing issues before but is now. This is the corrected script:
#!/bin/bash
jssUser="Username"
jssPass="Password"
jssURL="https://yourdomain.jamfcloud.com:443"
echo "Downloading list of class IDs..."
ids+=($(curl -X GET -s -k -u "$jssUser:$jssPass" "$jssURL/JSSResource/classes" | xmllint --format - | awk -F'>|<' '/<id>/{print $3}' | sort -n))
for n in "${ids[@]}"; do
curl -kvu $jssUser:$jssPass ${jssURL}/JSSResource/classes/id/$n -X DELETE
done
Directions on how to implement the script remain the same, however. I'll reprint them here so everything is in one place:
As I mentioned in the first post, just be careful doing this as it will wipe out all your classes in one go.
I am getting a "-:1: parser error : Document is empty" error. Any ideas?
For anyone finding this thread in the year 2024 -
There was a small typo in my script above which wasn't causing issues before but is now. This is the corrected script:
#!/bin/bash
jssUser="Username"
jssPass="Password"
jssURL="https://yourdomain.jamfcloud.com:443"
echo "Downloading list of class IDs..."
ids+=($(curl -X GET -s -k -u "$jssUser:$jssPass" "$jssURL/JSSResource/classes" | xmllint --format - | awk -F'>|<' '/<id>/{print $3}' | sort -n))
for n in "${ids[@]}"; do
curl -kvu $jssUser:$jssPass ${jssURL}/JSSResource/classes/id/$n -X DELETE
done
Directions on how to implement the script remain the same, however. I'll reprint them here so everything is in one place:
As I mentioned in the first post, just be careful doing this as it will wipe out all your classes in one go.
Hey @RPSadmin2, Thanks for the detailed directions. All seemed to be running smoothly, but when I run the sh file it just returns the response.
Downloading list of class IDs...
Then goes back to the command prompt. Its like nothing is running after printing that on the screen.
We are running JAMF Version11.3.0-t1707837736
Thanks,
Bill
Hey @RPSadmin2, Thanks for the detailed directions. All seemed to be running smoothly, but when I run the sh file it just returns the response.
Downloading list of class IDs...
Then goes back to the command prompt. Its like nothing is running after printing that on the screen.
We are running JAMF Version11.3.0-t1707837736
Thanks,
Bill
Hey @RPSadmin2, Thanks for the detailed directions. All seemed to be running smoothly, but when I run the sh file it just returns the response.
Downloading list of class IDs...
Then goes back to the command prompt. Its like nothing is running after printing that on the screen.
We are running JAMF Version11.3.0-t1707837736
Thanks,
Bill
Yes, unfortunately this script isn't working for me anymore either. I looked into it a bit and it seems like basic authentication is no longer supported, so it will need to be rewritten to support bearer authentication. Unfortunately I don't have time to re-write the script right now, however, this article seems to be a good starting point on how to tackle it: https://community.jamf.com/t5/tech-thoughts/how-to-convert-classic-api-scripts-to-use-bearer-token/ba-p/273910
If I get a chance to circle back to this and fix what I wrote previously I'll update this thread, but I'm not sure when that will be....
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.