Tuesday, 3 September 2013

Stop If Fails

Stop if Fails is one of the most mis-used and mis-understood items within an AppSense Environment Manager Configuration.

Stop if fails has absolutely nothing to do with actions or conditions immediately dependent on another action or condition. It does however have everything to do with the child (or sub) nodes that are dependent on a specific node.

Consider the following configuration snippet:


Stop if fails in enabled on the re-usable condition which is applied to the U1.1_User Profile node. This effectively means that the sub nodes U1.1.1_Create User Folders and U1.1.2_ProfileChange will not run unless the re-usable condition has been met.

Stop if fails has no impact on the actions that are dependent on the initial action or condition. These will run or not depending on whether the initial action or condition fails or succeeds.


Now with that same logic in mind, what happens if an action fails? In the example below I've configured a Map Drive action to map the M Drive to a server that does not exist. Will the registry hiving action that is dependent on the drive mapping action run?


The answer is no, the registry hiving action will fail because this is dependent on the Map Drive action succeeding regardless of whether Stop if fails is selected. 

Another example below. In this example I am attempting to launch an executable called oldcalc.exe when notepad launches and once oldcalc.exe launches I want to run cmd.exe. My workstation doesn't have oldcalc.exe installed so would you expect to see cmd.exe run or not? CMD.exe will not run because this action is dependent on oldcalc.exe launching. 


With the above in mind we must turn out attention to If Condition and Else If Conditions. By default a condition that is added to an If Condition or an Else If condition has Stop if fails enabled. 

This could potentially cause unexpected issues if you are trying to build a structured configuration as seen below you could experience redirection issues if the initial condition is not met because the standard stop if fails rule applies whereby child or sub nodes are not run. 



So where would I use Stop If Fails? Thats a good question... I use it very sparingly as you can see from the image above. Only my top level nodes make use of Stop if Fails. In the images above, U1.1 and U1.2 have stop if fails enabled on the same re-usable condition. This condition is a group that determines whether or not the user is enabled for AppSense Environment Manager Policy. I also use it on all Process Started conditions as you will see in the screenshots above. This is for the same reason as the top level nodes described above. That is it... I do not use Stop if Fails anywhere else within my configuration unless absolutely necessary. 

In summary, Stop If Fails has no bearing on whether child actions or conditions run or not. Renaming it to "don't process child nodes-if-fails"would be a more accurate description of what it is instead of "stop if fails". Everything else is just plain and simple logic. If something is indented underneath something else it is dependent on it and as such if it fails the child action or condition will not process. 

Thanks to @UVJim for reminding me about the If and Else If conditions.