Home > Casper, Jamf Pro, Scripting > Running multiple Jamf Pro policies via custom trigger

Running multiple Jamf Pro policies via custom trigger

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.

Screen Shot 2017 04 08 at 11 45 57 AM

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.

Screen Shot 2017 04 08 at 11 44 36 AM

 

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:

https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/Casper_Scripts/manual_trigger

If you want to run this script from your Jamf Pro server, it should be set up as follows.

Screen Shot 2017 04 08 at 12 08 04 PM

 

Screen Shot 2017 04 08 at 12 08 02 PM

 

 

Screen Shot 2017 04 08 at 12 07 58 PM

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.

Categories: Casper, Jamf Pro, Scripting
  1. April 8, 2017 at 8:45 pm

    You could also use the command option in Files and Processes to tell jamf PRO to start the next policy (I do this for licensing a package after install).

  2. Daniel Hayden
    August 5, 2017 at 1:55 pm

    I am a n00b, so is the params set in the script config in or in the profile or both?

  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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: