How to trigger a policy Once a month but also ad-hoc from custom trigger

perryd84
Contributor III

I have a LAPS solution running monthly to reset the local admin password but I also want to be able to trigger this after the password has been viewed.

I have a custom trigger but without flushing the logs the custom trigger only runs monthly as well.

Has anyone figured out a way to have a policy running on schedule but also be able to trigger it from a custom trigger on demand? The only way I see to do this is to create another policy which isn't best to duplicate things just for this.

5 REPLIES 5

sdagley
Esteemed Contributor II

@perryd84 Instead of a policy triggered via recurring check-in with a once every month frequency you could set it to just a custom trigger and use a LaunchDaemon running on your Macs to trigger that policy once a month by calling 

/usr/local/bin/jamf policy -event YOURCUSTOMTRIGGER

Hmmm thats a pretty good idea actually!! Thanks for this, let me test it out see if the functionality does what I want.

sdagley
Esteemed Contributor II

In case you haven't seen it before here's a handy tool for creating the LaunchDaemon: https://launched.zerowidth.com/

piotrr
Contributor III

You don't even need a launch daemon, you could use use two policies: 

Policy 1 Does what you wanted to do in the first place, with a Custom event "Policy 1" checked and "Ongoing" and a filled-out Self Service tab. 
Policy 0 Runs Files and Processes, Execute command above for custom trigger "Policy 1", and triggers on Recurring checkin with a Execution frequency of Once every month. 

Policy 1 can be run at any time, but policy 0 will also trigger Policy 1 once per month, at recurring check-in. 

...which is just what pete already said. Sorry! :) 

pete_c
Contributor III

You could also create 'nested' policies: the policy that actually Does Stuff, set to Ongoing with a custom event (trigger), then another policy set to once per month at check-in that calls the original's event.