Setup Your Mac – Using enrollmentComplete

I was recently asked by Dan Snelson, the creator of the Setup Your Mac script for Jamf Pro, to document my custom method of leveraging Jamf Pro’s enrollmentComplete trigger to run the Setup Your Mac script without the need of a Pre-Stage package.
There have been various reports in the past of the enrollmentComplete trigger being unreliable, however I have had zero issues with 100+ endpoints using this method.
I believe this may have to do with the fact that I use a very small WaitForDock script as my enrollmentComplete policy and use that as a shim to call the much larger main Setup Your Mac script, but I don’t have definitive proof… YMMV.

Initial Considerations

This method is not compatible with the Setup Your Mac’s requiredMinimumBuild and outdatedOsAction functions. It is also probably not compatible with any of the restart options in the main Setup Your Mac script.
For those cases you would most likely be much better off checking out the Setup Your Mac Pre-Stage package method from Rob J Schroeder, which can be found at his blog TechItOut.

How to use the WaitForDock script

In Jamf Pro I have two main policies for Setup Your Mac:

  • Provisioning – Setup Your Mac
    • Script:
    • Scope: All Computers
    • Custom Trigger: setupYourMac
    • Frequency: Ongoing
  • Provisioning – Wait For Dock
    • Script:
      • Parameter 4: /var/log/org.myOrg.log
      • Parameter 5: setupYourMac
    • Scope: All Computers
    • Trigger: enrollmentComplete
    • Frequency: Once Per Computer

TODO: Images of policies.

The Provisioning – Wait For Dock script accepts two parameters.
The first, parameter 4 in Jamf Pro, determines where the log events are stored on disk and should match parameter 4 from your main Setup Your Mac script.
The second, parameter 5 in Jamf Pro, should match what you set the custom trigger to for your main Setup Your Mac policy, in my case this is set to setupYourMac.
The benefit of using parameters is you can use a single instance of the WaitForDock script for multiple policies, EX: A production and testing policy. All you would need to change is the parameters and scoping.

The Setup Your Mac – Wait for dock script can be found at the following link: Github, or it is provided in the code block below.

Once you have both policies in place with the requisite parameters and scoping, simply enroll a Mac and make sure the Setup Your Mac window kicks off as expected. You can see what the WaitForDock script did and how long it waited by checking the log file specified in parameter 4. The output should look something like this:


Final Thoughts

As stated above this method has worked cleanly and without issue for my current fleet of ~100 Macbook Pros. I am confident that it should work for you as well as long as you have taken everything in the considerations section above into account.

If you have any additional questions, feel free to ask in the #setup-your-mac channel on the MacAdmins Slack.