What order do policies execute in?

p_owen
New Contributor III

I posted this earlier, and either it was too easy and I should have known the answer or it was too hard for the forum. So I'll try again :-)

If you build a policy that has three things identified in it:

A package
A script
A command (advanced tab)

What order do they fire in? Do they execute in parallel? Can I specify the sequence of these actions within the policy?

Thanks !

3 REPLIES 3

dpertschi
Valued Contributor

Generally speaking they execute in order from left to right in the Policy Editor.

However you can mark a script to run 'Before' or 'after' (beginning/end), but the Command field in the Advanced tab is always last last.

emmayche
New Contributor III

Since @dpertschi's response seems to be for an older version, I'd like to raise this question again.

Is there currently a way to specify in which order the components of a policy should be executed (and, if so, how), or is there a standard order of execution?

Josh_Smith
Contributor III

Hi @emmayche , there is a standard order (which you can bend to meet your needs).

In general the policy runs from top to bottom. Exception: Scripts can be set to install before or after the packages.

Packages: Package uninstalls run first before the installs. Within a group of installs the priority field is considered first, then they are installed alphabetically.
Scripts: If there are multiple scripts, the before/after field is considered first, then they are run alphabetically.

Fun ways to get the policy to run the way you want it to:
Wrap a script in a payload free package, then use the package priority field to wedge it between packages.
Use a customer trigger (via a script or payload free package) to call another policy in the middle of your policy....when that is done the original policy will continue.