erase-install --postinstall-command for deleting a machine from JamfCloud

Jon_L
New Contributor

We're using erase-install v.28.1 and in testing so far it's been great, really enjoying the new script and swift GUI.  I want to know if anyone else has used this or something similar in conjunction with a terminal command to delete the machine calling the script from Jamf.  

In this use case, the machine in question has a Self Service button to initiate a Factory Wipe, and we would like to call --postinstall-command that essentially runs: sudo jamf delete_computer ID=XXX where the machine we're running the command from is the one in question.  I've tested a few 1 line commands in " "s and they work, but I've not tried including a small script inside yet.  Unless there is an already easy way to show the machine's ID in a single line, I figured it would have to be nested in a small script, I just haven't put down the time yet to test, curious if anyone else has already done this or something similar.

1 ACCEPTED SOLUTION

sdagley
Esteemed Contributor II

@Jon_L erase-install has two options that you would find appropriate for triggering your deletion script: --preinstall-command and --postinstall-command. They are triggered immediately before and just after startosinstall runs respectively (see https://github.com/grahampugh/erase-install/wiki/4.-Upgrading-macOS#--preinstall-command for more details)

View solution in original post

5 REPLIES 5

sdagley
Esteemed Contributor II

@Jon_L There isn't a jamf binary verb named delete_computer so it'd need more than a simple terminal command. You would have to use  script to call the Jamf API to do the deletion, and I don't think you're going to fit that into a script parameter for erase-install. You could call another Jamf Pro policy to run a deletion script from your erase-install script though.

MrChris
New Contributor III

This is the way

Jon_L
New Contributor

Thanks for the quick clarification @sdagley we'll give that a shot :D (probably set it to run the delete script before it kicks off the wipe script so we'll make sure to cache it beforehand.)

Initially, we thought to call a policy/script when the erase-install policy is completed, but it does not report back completed when it actually wipes the machine :) 

sdagley
Esteemed Contributor II

@Jon_L erase-install has two options that you would find appropriate for triggering your deletion script: --preinstall-command and --postinstall-command. They are triggered immediately before and just after startosinstall runs respectively (see https://github.com/grahampugh/erase-install/wiki/4.-Upgrading-macOS#--preinstall-command for more details)

jwojda
Valued Contributor II

I'd be interested in your solution as well.  We have a ton of devices that seem to get device signature errors after using the erase and install.sh script.  Jamf's suggestion was to delete the ID of the device.