Skip to main content
Solved

Trigger policy from command line


Forum|alt.badge.img+13
  • Honored Contributor
  • 253 replies

I am testing a policy. I want to run the policy from a command line. I know the command is jamf policy -event XXX
But Im getting "No policies were found for the "XXX" trigger

I used this method in the past for testing. What could possible be the problem now?

Thanks in advance

Best answer by CapU

I had the incorrect syntax for what I was trying to do. I had:

Jamf policy -event XXXX

I should have had:

Jamf policy -id XXXX
View original
Did this topic help you find an answer to your question?

9 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • June 4, 2018

Scope? Execution Frequency? Either of those could be affecting things now. For example, the Mac you're testing on needs to be in scope for the policy to execute, whether manually added in to the scope or via a Smart/Static Group or such.
Second, make sure the policy isn't set to a 'Once per computer' frequency, as that would mean each time you run it, it needs to be flushed from the policy log in order for it to run again on that same machine. For testing, if you need to test repeatedly, set the execution frequency to Ongoing, but remember to set it back to whatever actual frequency you want the policy at once done with your testing.


Forum|alt.badge.img+13
  • Author
  • Honored Contributor
  • 253 replies
  • June 4, 2018

Thanks for the response @mm2270 I checked both those and my test machine is in the scope. I just changed the frequency to ongoing for testing. Still no luck. In fact when I attempt to run any policy from the command line it fails. This is some thing new


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • June 4, 2018

Hmm. Did you happen to cancel the policy the last time it was run before it completed?


Forum|alt.badge.img+13
  • Author
  • Honored Contributor
  • 253 replies
  • June 4, 2018

No.
I even went into the Jamf/Reciepts just in case......
Just for snorts and giggles I cloned another policy, assigned to my test machine and set frequency to ongoing. Still not working. To be clear if I use Jamf Remote it works, however the checkin policy does not work


Forum|alt.badge.img+16
  • Valued Contributor
  • 1002 replies
  • June 4, 2018

Exclusion based on user? JAMF Remote would not need a user logged into the machine, but running it locally would and that user could be excluded.


Forum|alt.badge.img+7
  • Valued Contributor
  • 74 replies
  • June 5, 2018

Using Terminal JAMF commands requires SUDO on an Admin account. Even is you SU into the account.


Forum|alt.badge.img+13
  • Author
  • Honored Contributor
  • 253 replies
  • Answer
  • June 5, 2018

I had the incorrect syntax for what I was trying to do. I had:

Jamf policy -event XXXX

I should have had:

Jamf policy -id XXXX

Forum|alt.badge.img+7
  • Valued Contributor
  • 74 replies
  • June 5, 2018

You can use -event or -trigger for "Custom Event", or -id for Policy ID#.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • June 5, 2018

OK, well, that would explain it. I actually did wonder briefly if you were using the right flag, but I figured that was correct and it was something else going on. Glad you got that straightened out.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings