Custom Script during User Initiated Enrollment

jason_bracy
Contributor III

Is it possible to have a script run as a pre flight script during User Initiated Enrollment rather than as a policy that kicks off during Enrollment complete?

My current setup for User Initiated Enrollment has 2 policies that run with the Enrollment complete flag:
1. Names the computer to the S/N then Sets Ethernet Search Domains and NTP server
2. Joins the computer to Active Directory

Lately I have noticed several Macs showing up in AD with default names like "Users MacBookPro". When looking at the log, even though the first policy is set to run first (named with a 1 in front) the Join AD policy is actually running first, so the computer has not yet been renamed. I am not able to reliably repeat this behavior, so the only option I have is to set the AD Join policy to run with the startup trigger, and configure the first policy to immediately restart the computer.

Ideally I'd like the JSS to rename the computer during enrollment as part of the Quick-Add package, but I can't figure out how to do this with User Initiated Enrollment. I know that I can modify a package created with Recon, but then I would need to manually assign the user in the JSS. With User Initiated the user signs in with AD credentials and the computer is automatically assigned.

2 REPLIES 2

bkramps
New Contributor III

@jason.bracy I don't know of a way to setup a Preflight with User Initiated QuickAdd. One way though for you to get your Policies to run in the order you want is to use Custom Triggers. Have your 1st Policy trigger with Enrollment Complete. In that policy have an "After" script that triggers the next Policy (i.e. jamf policy -event youreventname).

In the 2nd Policy, have the trigger as Custom=youreventname, not Enrollment. This will allow you to put your policies into sequence.

jason_bracy
Contributor III

Hadn't thought of that. Never really looked at Custom Triggers.

Thanks