Home > Jamf Pro, macOS, macOS Recovery, Scripting > Booting to macOS Recovery or Diagnostics via Jamf Pro’s Self Service

Booting to macOS Recovery or Diagnostics via Jamf Pro’s Self Service

One of the advantages provided by Jamf Pro’s Self Service is that you can use it to provide easy access to tools for your users or helpdesk folks. One such tool could be a script which helps folks boot to their Macs to one of the following Apple support services:

For more details, please see below the jump.

This script sets one of four boot arguments and passes it to NVRAM:

  • RecoveryModeDisk – Boots to the Recovery volume on your local boot drive
  • RecoveryModeNetwork – Boots to Internet Recovery
  • DiagsModeDisk – Boots to the Diagnostics or Apple Hardware Test volume on your local boot drive.
  • DiagsModeNetwork – Boots to Internet Diagnostics or Apple Hardware Test

Note: If booting to macOS Recovery, this script will set the logged-in account to have admin privileges. This is because, on Macs equipped with T2 security chips, an admin account is needed to be able to access the macOS Utilities tools in the Recovery environment.

Macos catalina recovery mode auth installer password

To set it up for use with Jamf Pro, do the following:

1. Add the script to Jamf Pro.

Screen Shot 2020 03 24 at 4 58 31 PM

Screen Shot 2020 03 24 at 4 58 35 PM

2. Create a new Self Service policy.

Screen Shot 2020 03 28 at 4 38 19 PM

Screen Shot 2020 03 24 at 5 02 19 PM

3. Select the script as part of the policy.
4. Set the policy’s Execution Frequency to Ongoing.

Screen Shot 2020 03 28 at 4 38 20 PM

5. Set target scope as desired.

Screen Shot 2020 03 24 at 5 03 17 PM

Note: While this script was written with Jamf Pro’s Self Service in mind, it should be adaptable with either no alteration or minor edits to other Self Service tools which can run scripts.

Once the policy is set up in Jamf Pro, it should look like this when run.

Screen Shot 2020 03 24 at 5 11 55 PM

Screen Shot 2020 03 24 at 5 12 03 PM

Screen Shot 2020 03 24 at 5 12 10 PM

When the Mac restarts, it should boot to Diagnostics or macOS Recovery (depending on your choices.)

Diagnostics checking mac

Screen Shot 2020 03 24 at 4 34 21 PM

The script is available below. It is also available from the following location on GitHub:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/set_recovery_or_diagnostics_boot_mode

  1. Hinrich
    March 30, 2020 at 8:44 am

    Great!
    Will this even work if the efi firmwarepassword is enabled? Or will it by-passed if set boot args are set via nvram?

    • Wicker
      April 2, 2020 at 1:31 pm

      +1 Hinrich, I would also be very interested to know if it works with Efi set. Thanks.

    • moojomoore
      April 3, 2020 at 6:40 pm

      Just tested it and it looks like it asks for a firmware password. 😦

  2. macbro
    April 3, 2020 at 11:19 pm

    will the elevation of the permissions reset after the user logs back in?

  3. April 8, 2020 at 9:23 pm

    Fantasic Rich. But why should Jamf Pro people have all the fun? I adapted it for Munki Self-Service and added it to my collection of (now 24) items.
    https://github.com/precursorca/Munki-SelfService-On-Demand

  4. txhaflaire
    May 20, 2020 at 3:00 pm

    @wicker i have adopted this method from Rich and slightly modified for the diagnostic part the firmwarepassword it temporariliy removed, before restart/shutdown to diagnostics a LaunchDaemon is being created which unloads and removes itself after booting up again and it triggers an policy to enable the firmwarepassword directly after the mac comes online

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: