As a follow-up to my previous post about running multiple Jamf Pro policies via the API, my colleague John Kitzmiller pointed out that it was possible to achieve similar functionality by using a custom trigger. For more details, see below the jump.
A Jamf Pro policy can be called using a keyword by setting a custom trigger.
This keyword can then be run using the following command:
jamf policy -event trigger_keyword_goes_here
You can also use the custom trigger synonym of trigger instead of event in the command.
jamf policy -trigger trigger_keyword_goes_here
To set the order for the policies called by the custom trigger, I need to use numbering as part of the policy name. The first policy name starts with 010, the second policy with 020 and so on.
Once the policies are in place, a script like the one shown below can be used to run the policies in their specified order by calling the custom trigger’s keyword.
The script is also available on Github at the following address:
If you want to run this script from your Jamf Pro server, it should be set up as follows.
To use this capability, you will need to set the custom trigger with each of the policies you want to run and then set the script to use that custom trigger. The script will send the custom trigger to the Jamf Pro server, which will then run all policies associated with the custom trigger keyword in the specified order.