Skip to main content
Question

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

  • May 24, 2012
  • 11 replies
  • 51 views

MacMaul
Forum|alt.badge.img+6

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

Forum|alt.badge.img+17
  • Honored Contributor
  • May 24, 2012

In post image script put

jamf flushPolicyHistory


MacMaul
Forum|alt.badge.img+6
  • Author
  • Contributor
  • May 24, 2012

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?


Forum|alt.badge.img+6
  • Contributor
  • May 24, 2012

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.


Forum|alt.badge.img+17
  • Honored Contributor
  • May 24, 2012

Script would be at reboot.

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


mm2270
Forum|alt.badge.img+24
  • Legendary Contributor
  • May 24, 2012

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.


Forum|alt.badge.img+6
  • Contributor
  • May 24, 2012
@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.


MacMaul
Forum|alt.badge.img+6
  • Author
  • Contributor
  • May 24, 2012

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


Forum|alt.badge.img+17
  • Honored Contributor
  • May 25, 2012

Once, when imaging is done.


Forum|alt.badge.img+15
  • Valued Contributor
  • October 9, 2013

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


Forum|alt.badge.img+18
  • Esteemed Contributor
  • October 9, 2013

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


Forum|alt.badge.img+13
  • Contributor
  • October 9, 2013

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