Flush policy logs at reimage to rerun "Once per computer" "startup" scripts?

PhilMaul
New Contributor II

Is there a way to automatically flush the policy logs after reimaging a machine? I have scripts that are using the "startup" trigger and the "Once per computer" frequency that I would like to have run again once the machine is reimaged.

11 REPLIES 11

CasperSally
Valued Contributor II

In post image script put

jamf flushPolicyHistory

PhilMaul
New Contributor II

I am assuming that the post image script is just a script that is set to run "After" that I would add to the Configuration? Or is there a script that's already somewhere that I need to edit?

natkins
New Contributor III

I was under the impression that once a computer had a new OS imaged/installed, regardless of the method (Casper/DVD/etc) it was considered to be a "new" computer, in terms of policy.

CasperSally
Valued Contributor II

Script would be at reboot.

@natkins - no policy history isn't wiped at reboot unless you run that command.

mm2270
Legendary Contributor III

CasperSally is correct, any policies that had previously run on it that were set on a "once" type basis will not run again unless you flush the policy history for that system, because Casper Suite uses the MAC address to identify systems. So even if it got a new name, new OS on it, etc, it still sees it as the same Mac that already ran those once per computer policies.

You can also overcome this issue with things like Extension Attributes, Smart Groups and ongoing policies, but unless they are set up that way, flushing the policy history for that Mac is probably your best bet.

natkins
New Contributor III
@natkins - no policy history isn't wiped at reboot unless you run that command.

Right, my mistake. We're using custom triggers that I thought were set to "Once per computer", but were in fact set to Ongoing.

PhilMaul
New Contributor II

So selecting "At reboot" will run the script at every reboot?

CasperSally
Valued Contributor II

Once, when imaging is done.

tep
Contributor II

I have put jamf flushPolicyHistory in my FirstBoot script (set to run at reboot after imaging), but the policies are not flushing.

GabeShack
Valued Contributor III

You may want to make sure it is the 1st of your scripts running after the reboot, since it goes alphabetically I just added an a to the beginning of the name of my flush policy script.
Gabe Shackney
Princeton Public Schools

Gabe Shackney
Princeton Public Schools

Kumarasinghe
Valued Contributor

We have removed the command from our Post Image script as it is part of imaging now.
https://jamfnation.jamfsoftware.com/discussion.html?id=7952