HELP: Deleting a computer from Jamf via script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi,
I appreciate if anyone can share a script that can delete the computer from which the script is executed from the JamfPro (onprem server). It would be great if the script can delete the computer getting the computer ID or computer name and check with Jamf and delete if available and then remove all the profiles including the CA certificate, basically remove the framework.
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@BlackTiger You've got the process a bit backwards. You'll want to un-manage the Mac to remove the profiles before deleting it from Jamf Pro. And per Jamf's recommended best practices the remove from Jamf Pro script is something you'd run from a management machine, not an arbitrary endpoint.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Maybe I didn't explain it clearly; my bad, sorry. I want to run a policy with a custom event trigger (script) that can do the below in order
1. Get the computer ID (or computer name or Host name)from the computer where the event is executed (Ex: from a end user mac terminal we run this command)
2. Check the computer ID in JamfPro if the same computer ID is available.
3. If available, delete the computer from Jamf Pro server.
4. Delete all the profiles from the Macbook, including the CA certificate. Basically, removing the framework.
The workflow in my work place is different so if I have this script it will help my team to keep the Jamfpro tidy.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
@BlackTiger You still have the sequencing wrong, because deleting the computer from Jamf Pro will remove your ability to remove the MDM Profile and all of the other profiles that have been pushed to the Mac.
Are you're simply looking to wipe a Mac so that it can be re-issued, or are you looking to remove Jamf Pro and leave the device intact?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
Throughout the year, many students return their old MacBooks and get new ones. Our tech team currently has to manually search for those returned MacBooks in Jamf, delete them from the server, and also remove all profiles from the devices. This is a time-consuming process.
I want to create a script that can do both tasks with a single (custom event) command. This would save time and make the process more efficient.
It would also help keep the Jamf Pro server clean and up to date. Sometimes, old devices aren’t removed, which increases the total device count. Before every renewal, we have to do a manual check and cleanup, which takes extra effort.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a week ago
@BlackTiger Is your environment completely moved over to Apple Silicon Macs, or do you still have Intel based Macs in the mix? It sounds like you're trying to return these Macs to a ready to deploy state with the existing Jamf Pro enrollment removed. If that's the case you really should be wiping the Macs, and with Apple Silicon Macs you have physical possession of that's extremely easy with the DFU Restore process:
https://mrmacintosh.com/restore-macos-firmware-on-an-apple-silicon-mac-boot-to-dfu-mode/
https://twocanoes.com/products/mac/dfu-blaster/
You'll still have to delete the Mac record from Jamf Pro but the DFU Restore will eliminate the need to perform any cleanup steps on the Mac itself.
