Trigger policy from command line

CapU
Contributor III

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

1 ACCEPTED SOLUTION

CapU
Contributor III

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 solution in original post

9 REPLIES 9

mm2270
Legendary Contributor III

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.

CapU
Contributor III

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
Legendary Contributor III

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

CapU
Contributor III

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

Look
Valued Contributor III

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.

c_archibald
Contributor II

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

CapU
Contributor III

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

c_archibald
Contributor II

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

mm2270
Legendary Contributor III

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.