Script for input during Casper Imaging?

alexjdale
Valued Contributor III

Before I start messing around with this idea, I wanted to see if anyone else has done it so I can shamelessly borrow some ideas/workflow.

Right now, we have a scenario where we bare-metal image Macs using a USB stick with Casper Imaging, and the technician has to log into the system after the imaging is completed to do a little data entry (asset number, site location, deployed user) via a Self Service script that also performs the computer naming/AD bind/wifi setup.

I'd like to do all that data-entry up front. Has anyone been able to run a script from a USB boot stick/Netboot as part of the Imaging workflow, capture data, and somehow get that data to the imaged drive so a policy can read it and operate on it when imaging is done? Having it prompt right after the imaging configuration kicks off is ideal rather than waiting until the image and packages are all copied over, to save tech time.

We have another workflow for thin imaging, but obviously bare-metal has a place when you need to wipe/reimage/redeploy and I'd like to make that process more automated.

Edit: Looks like I found a method to do this with a Before script and After script, the tricky part I am not happy with is identifying the volume that was imaged to write the data to. In a standard USB use case I can expect disk0s2 is the right one, but if someone images a target drive via Thunderbolt that wouldn't work.

3 REPLIES 3

bentoms
Release Candidate Programs Tester

@alexjdale As per this article.

Running a script via Casper Imaging using $1 will return the mount path of the target drive (for example, /Volumes/Macintosh HD).

Does that help?

dwandro92
Contributor III

I have not done it from a USB stick, but I am already using a solution like this on our Restore partition. Rather than saving the information to the Mac and gathering/uploading the information with a post-imaging policy, my solution updates (or creates) the JSS computer record using the API.

alexjdale
Valued Contributor III

Thanks for the tip @bentoms, I didn't realize that would work that way in Imaging. I'll have to try that out.

That said, I've come up with a working POC that lets me use Pashua to capture a bunch of information with one script immediately after the tech initiates the image in Casper Imaging, writing that data to the USB drive as a plist which gets copied over to the target drive after the block copy phase in a second script. After the reboot, another script reads in that data, renames the system, and performs the AD bind/configures wifi. One last script runs on startup after the final reboot to perform some system checks and then emails the tech with success/failure and status.

One main reason I wanted to do this was to remove the tech's need to ever log in with a local admin account. Once this process finishes, they can log in with their own credentials (granted admin via an AD group). We're making some pretty major changes to how we handle local admin accounts, and this was one important step.