Skip to main content
Question

Deleted prestage, way to recover it?

  • January 31, 2020
  • 9 replies
  • 106 views

gcarmichael
Forum|alt.badge.img+10

Ill start off that Im pretty sure I know the answer for this already but here it goes.

My coworker was removing machines from a prestage and got lost doing something and forgot where/what he was doing. He then deleted our Student prestage (2800 machines tied to it, 10 policies, a bunch of config profiles. extension attributes, others Im probably forgetting) thinking he was deleting its inventory record. I have shut the infrastructure down for now, and doing a recovery from last nights backup on the database vm. Anyone know if there is a cached copy somewhere in the database that I might be able to recover without the full vm recovery? Any ideas would be very much appreciated.

9 replies

bradtchapman
Forum|alt.badge.img+20
  • Valued Contributor
  • February 1, 2020

Ouch. The PreStage Enrollment communicates with Apple, which means if you delete that, you're telling Apple that these machines aren't part of a prestage anymore. You might be able to recover the configurations by reverting to a previous database backup, but you might need to unassign / reassign the devices as well.

I say might ... only because Jamf syncs with Apple's automated device enrollment every 5 minutes. I don't know if it sends the full computer list every time. I'd have to believe that Apple's API assumes the MDM is authoritative when it comes to which machines are in which prestage.


TechM
Forum|alt.badge.img+9
  • Contributor
  • February 1, 2020

I would reach out to Apple Support and see if they have any suggestions. You may just need to re-do your tokens for that PreStage. Newly deployed devices that were in the process of being provisioned may be impacted, but the rest maybe are ok? I'd contact Apple.


Forum|alt.badge.img+10
  • Valued Contributor
  • February 2, 2020

I would think a database restore from backup would be the answer here. If you have nightly backups then you only lose the data after the backup was taken. Since you shut services down most devices likely don't even know the Prestage is gone. I would discuss this with Jamf support just to be sure though. They might be able to work some magic. The only other option I could see is recreating the Prestage and reassigning and rescoping. The reassging could be done with the UAPI and depending how many smart groups you setup based on prestage enrollment you might find rescoping easier than you think.


Forum|alt.badge.img+26
  • Honored Contributor
  • February 3, 2020

Not ashamed to admit I've done this before...I HATE when it happens....I will say that I recovered from it by restoring my nightly backup and that it occurred during summer break when the stakes were much lower. In my case, the only thing I lost when it happened was my day's progress in configuring, but at that time I weighed the stakes...losing my days progress or having to recreate that prestage manually. I basically restored the backup and stayed late one evening over the summer and things were better. Hopefully you've made the call on this one already...the more days pass since you did it and the more painful going to the backups becomes.


stevewood
Forum|alt.badge.img+38
  • Hall of Fame
  • February 3, 2020

@gcarmichael

I would restore to a new "dev" server, that way you won't lose any data. Then re-create the PreStage. Once the PreStage is re-created you just need to re-enable the devices. In fact, unless you had some crazy settings in the PreStage that you cannot recall, you shouldn't really need to restore the database at all.

Since the machines assigned are coming from the Device Enrollment settings, and that ultimately comes from ASM where you assign the devices, the worst case might be that you have to adjust some Smart Groups if you do not name the PreStage the same.


cdenesha
Forum|alt.badge.img+14
  • Honored Contributor
  • February 3, 2020

I hope your restore fixed things. Based on the fact that if you rename a PreStage, then each device reflects the name change, thus every device is linked to the PreStage by using a unique identifier. So I'm guessing your devices no longer show as being in a PreStage, and you are using that as a criteria for scoping, and everything is falling out of scope, and profiles are uninstalling.

I agree with the advice that you'd have to rescope everything if you create a new PreStage.


gcarmichael
Forum|alt.badge.img+10
  • Author
  • Contributor
  • February 5, 2020

Thanks all. Being as I was 48 hours from my cloud migration we did nothing. We just moved forward. Apples suggestion was to make my "test" Student prestage the main by making it the default, and take blocks of the assigned machines and un-assign in Apple School Manager, and then wait a day and re-assign them all.


Forum|alt.badge.img

Running into this problem myself.. one of our admins removed a PreStage enrollment group. Anyone now if there's a log that tracks which user account did this?


Forum|alt.badge.img+6
  • New Contributor
  • February 29, 2020

Change Management Logs
Use web browser search to find rows with Action of “Deleted”
Eventually you should find a row with Object Type: Mobile Device PreStage Enrollment and Object Name: blank. Details will show the name of the PreStage.