Machine Decommissioning - Best Practice

New Contributor III


We've not long been using Casper but currently have it quite successfully managing our Student facing machines. Some of these are now over 3 years old and will soon be replaced as part of our rolling upgrade program.
Does anyone have any tips or best practice processes for doing kit upgrades?

I was thinking that the kit coming out would need to be - - Renamed (to save a clash should it redeployed elsewhere)
- Re-imaged with a base OS
- Remove the JAMF framework from the machine

Is there a quick and easy way to do this within the JSS?
Any thought would be greatly appreciated.


Esteemed Contributor
Esteemed Contributor

@Crawford You can un-manage the Macs from the JSS to stop the JSS running policies on them, if wanted to keep a record.. Else delete from the JSS.

I'd then use Imagr as per: this or maybe even internet recovery & vote up this FR

Valued Contributor III

If the model in question supports it use Apple Internet Restore.
They will end up looking like they did the day they came from Apple including the original version of OS X.
Remember to disable them in DEP if you are using this otherwise they will forever keep trying to rejoin Casper.

New Contributor III

Thanks for the info!
To minimise downtime for the students this is what I've come up with - what of you think?

Just before the machine is to be replaced run this script remotely -


sets machine name back to serial number

sudo jamf setComputerName -useSerialNumber

flushed the history on the machine

sudo jamf flushPolicyHistory

updates the JSS record with the new name, allowing the old name to be reused

sudo jamf recon

time for above to finish

sleep 35

removes the Casper items from machine and frees up a license

sudo jamf removeframework

The machine can then be Internet Restored back at the technicians room ready for re-deployment.

Honored Contributor II
Honored Contributor II

@Crawford The only problem with your script that I see is the placement of the recon statement. By putting it after the flushPolicyHistory statement, you could trigger all policies that the machine is eligible for to run again. I could be mistaken by this, but IIRC that's what will happen.

Also, once you've done all of that, you'll still have the record in the JSS. You'll want to either delete it or mark it as unmanaged.

When I have equipment going back on lease, I will take one of the machines, erase the drive via Disk Utility, apply whatever OS is the latest via an external USB drive, and then I will capture that OS using Disk Utility. Then, on each machine that is going back I will boot them from an external drive, erase the drive, then restore that disk image I captured onto the drive. That gives me a fresh, never booted OS on the machine. I then go into the JSS, re-name the machines "LEASE RETURN" in the JSS, uncheck the Manage checkbox. I'll then do a computer search for all of those machines, export them as a CSV file, and then delete them from my JSS. That way they do not show up in searches.

Hope that helps.

Valued Contributor II

So those scripts aside, are you using Casper Imaging via NetBoot? If so, then why run the scripts? If you're going to image them anyway they can all have something like the "LEASE RETURN" as a prefix in the name ahead of the serial number. This can be set via pre-stage or manually at the point of imaging. Deleting them after would be as simple.

We run a slightly more elaborate "Decommissioning" process at the end of our year as we are student provided BYOD primarily and they keep them when they leave. Some of these scripts may help you in what you're working on currently. I'm going to make another writeup on my updates to the process but here's how it looked a year ago (

Also, have you ever tried using AutoDMG to create an OS installer? You can drag that .dmg straight into Casper Admin to distribute via Casper Imaging (hit the checkbox for "Show OS X Setup Assistant" in the "Advanced" tab and you're good to go). Again, a lot depends on whether or not you can use NetBoot and Casper Imaging.