Force policy to (re)run via script?

mm2270
Legendary Contributor III

Hey all, anyone know of a way to force a policy to run again on select systems that have already run it, by using the "jamf policy -id <id" command, or some other way? For example, if you have a policy that is set to "Once every day", can you make it run again before the 24 hours is up via a script?
In my initial tests, using the above syntax, I just get the "No Policies were found for the ID <id>" error. I'm certain I'm using the correct policy id number, and the system is in the scope for the policy, so I'm guessing its because its set for once per 24 hours and won't execute again until its time.

I know about the "flushPolicyHistory" flag for the jamf binary, but there is no description about it in help, and I'm concerned it flushes ALL policy histories, which is not something I want to do. I'm just looking to target the one policy that I would like to force run again.

So, anyone know if there is some way to accomplish this?

1 ACCEPTED SOLUTION

dhowell
Contributor

Scopes overrule even if used via command line, I usually Duplicate the Policy and set it to none and call it via sudo jamf policy -id ***

View solution in original post

5 REPLIES 5

dhowell
Contributor

Scopes overrule even if used via command line, I usually Duplicate the Policy and set it to none and call it via sudo jamf policy -id ***

mm2270
Legendary Contributor III

Yeah, that's what I figured too. I just thought I'd ask on the off chance there was some undocumented way around it, but there probably isn't. I think I have a way I can achieve what I'm looking to do without duping the policy though.

Thanks for the reply.

jarednichols
Honored Contributor

Yeah scope trumps all. If it's not in scope, you can't force it to run.

mqh777
New Contributor

Where do you find the policy ID?

CasperSally
Valued Contributor II

@mqh777 - go to JSS, mgmt, find policy, edit policy, look at URL - will end with policy_id=xxx giving you the ID