-
-
Notifications
You must be signed in to change notification settings - Fork 136
6. Use in Jamf Pro
There are two ways you can use the script in Jamf Pro.
The installer package contains the latest copies of erase-install.sh
, mist
and swiftDialog
. erase-install.sh
is installed into the /Library/Management/erase-install
folder.
Attach this package to a policy, and use the Execute Command field to run the script with the desired parameters, for example:
/Library/Management/erase-install/erase-install.sh --os 12 --update --reinstall --confirm
Alternatively, you can add a launcher script to the policy that runs the above command. The advantage of a launcher script is that if erase-install fails for some reason, this will get reported as a failure to the Policy Logs, whereas the Execute Command always returns a success.
We supply an example launcher script, erase-install-launcher.sh
, that you can upload to Jamf, add to your policy, and add your erase-install.sh arguments into the policy's script parameter fields (not the Parameter Labels of the script itself!!).
If you upload the script directly into Jamf Pro, and are intending to attach it to a policy, then you can use script parameters to provide the arguments.
In the script parameters of the Policy (not the Parameter Labels of the script itself!!), add the desired options, including the --
double-dashes, just as if you are supplying them in the command line. Any parameters which provide a value must use an =
so that they are interpreted as a single parameter. It does not matter which order the parameters are added.
For example, to create a policy named Erase and Reinstall macOS which is scoped to models of Mac that will reinstall the same macOS Version as is currently installed, set parameters as follows:
- Parameter 4:
--erase
- Parameter 5:
--sameos
If you want to download a particular version of macOS, create a policy scoped to the devices that require the specific version, and set parameters as follows (make sure to use an equals sign for parameters that require a value):
- Parameter 4:
--erase
- Parameter 5:
--version=12.6.2
If you want to upgrade to the latest macOS, use:
- Parameter 4:
--reinstall
If you want to upgrade to the latest macOS and ensure that any cached version is replaced when it gets out of date:
- Parameter 4:
--reinstall
- Parameter 5:
--update
If you want to upgrade Macs running Big Sur (11) to the latest version of Monterey (12), use:
- Parameter 4:
--reinstall
- Parameter 5:
--os=12
If you just want to cache the latest installer app on the client, then I recommend this parameter:
- Parameter 4:
--update
Just to reiterate, any parameter can be supplied in any order in the policy's Script Parameters section, and only one parameter can be supplied into each Parameter field.
Please note that when using this script in a Jamf policy with the --erase
or --reinstall
options, the policy will not be logged as completed, because the computer restarts before the script can complete. Therefore, it is important that you do not have this policy set to run automatically on a "Once Per Computer" basis. I recommend that you use it in Self Service, and for use with --reinstall
(for upgrading) scope based on whether the OS you want to be installed is already on the client. For this to work effectively, you will want to create a policy that Updates Inventory on startup.
If you use a separate launcher script you can at least get a recon sent if the policy fails. See our example launcher script here. Note that our example script will not process any --preinstall
or --postinstall
arguments properly if they contain spaces.