Conditions
A condition determines whether a Task, Module or Run Book Job should be executed, skipped or failed. A condition determines to which settings a Task, Module or Run Book Job in a Job must comply before it is executed. A condition contains one or more expressions that determine whether the condition can be satisfied and defines what action should be taken based on this. Conditions are optional.
- Task conditions determine whether a Task in a Module should be executed, skipped or failed. Task conditions can be set when configuring Tasks and Modules.
- Module conditions determine whether a Module in a Project should be executed, skipped or failed. Module conditions can be set when configuring Projects.
- Job conditions determine whether a Job in a Run Book should be executed, skipped or failed. Job conditions can be set when configuring Run Books. When configuring Job conditions, only the expression types Date Time, Parameter and Status of Previously Executed Job are available.
Example
For example, a Module could contain the following:
- Task Export Exchange Mailbox
- Task Disable Exchange Mailbox
- Task Send E-mail
If the Task Disable Exchange Mailbox fails, the administrator should receive a warning by e-mail. To achieve this, you can set the following condition on the Conditions tab of the Task Send E-mail:
- Expression: Status of previously executed Task = Failed.
- If this condition is FALSE then: skip this Task
- If this condition is TRUE then: execute this Task
Configuration
Expressions
- Condition expressions can be based on the following operands:
- Computer Function
- Date Time
- Environment Variable
- File/Folder Operations
When basing the value of a condition expression on the existence or version of a file or folder:
- You cannot use functions in the Operand field.
- You can use parameters and global Variables in the Operand field.
- It is possible to use environment variables in the Operand field: right-click and select Replace folder names with their associated environment string.
- File Version
- Product Version
- File Exists
- Folder Exists
- Fully Qualified Domain Name
- Operating System
- Bit Version
- Suite
- Type
- Version
- Parameter
When basing the value of a condition expression on a parameter, the value of this parameter can be based on another parameter or a function. Except for password parameters based on another parameter.
- Processor Architecture
- Registry Setting
When basing the value of a condition expression on a registry setting:
- You can specify registry keys with a backslash (\) at the end of a setting (as in HKEY_LOCAL_MACHINE\SOFTWARE\RES\AutomationManager\WMC\). You can specify registry values without a backslash (as in HKEY_LOCAL_MACHINE\SOFTWARE\RES\AutomationManager\WMC\DBServer).
- It is also possible to check whether this registry setting actually exists, by using the operator Exist. This allows you to create Tasks that are only executed if a specific registry setting exists in the registry of the Agent. This can be useful for example, if a Task should only be executed if a specific version of an application has been installed, but this information is only stored as a registry key.
Example
Adobe Acrobat Reader stores its version number (for example, 11.0) in the registry as HKEY_CURRENT_USER\SOFTWARE\Adobe\Acrobat Reader\11.0\.
If a certain Task should only be executed if Adobe Acrobat Reader 11.0 has been installed, you can set a condition for this Task based on the registry key HKEY_CURRENT_USER\SOFTWARE\Adobe\Acrobat Reader\11.0\. If you use the operator Exist with the value True, Ivanti Automation will check the existence of this key in the registry of the Agents that perform the Task. If the condition returns True, this means that the registry key exists and thus that Adobe Acrobat Reader 11.0 has been installed.
- Status of previously executed Task/Job
When configuring a condition, you can use several operators. See Pattern Matching: wildcards and operators for an overview.
Conditions based on existence of file or folder
When basing the value of a condition expression on the existence or version of a file or folder:
- You cannot use functions in the Operand field.
- You can use parameters and global Variables in the Operand field.
- It is possible to use environment variables in the Operand field: right-click and select Replace folder names with their associated environment string.
Validation
When you select the validation rule (all expressions or at least one), you can validate the individual expressions and show the condition results (True , False , Unknown )
- Validation is done on the current machine at configuration.
- Validation is done on the target Agent at run-time.
If condition is True/False then
You can configure the action that needs to be performed when the condition results in True or False:
- Execute this Job
- Skip this Job
- Skip this Job and all remaining Jobs in this Run Book
- Execute this Job, but skip all remaining Jobs in this Run Book
- Allow to set a parameter value based on the results of the condition. For example, if you configure a Change Service Parameters Task to restart a certain service on a number of Agents, this service can have a different name, depending on the operating system of the Agent. By letting the condition result set the correct parameter value (for example, the Windows Firewall services SharedAccess or mpssvc), the Task will restart the correct service on each Agent.
After configuring the expressions, you need to define whether all expressions in the condition need to be satisfied, or at least one. You also need to define which action should be carried out if the expression has or has not been met:
- Fail this Task (only available if you configure a Task): The Task will show a Failed status in the Job history.
- Skip this Task/Module/Job: Skips the Task, Module, or Job and continues with the next.
- Skip this Task/Module/Job and all remaining Tasks/Modules/Jobs in this Module/Project/Run Book: Skips this Task, Module or Job, and all remaining Tasks, Modules, or Jobs in the Module, Project, or Run Book.
- Execute this Task/Module/Job: Executes the Task, Module, or Job.
- Execute this Task/Module/Job, but skip all remaining Tasks/Modules/Jobs: Executes the Task, Module, or Job and skips all remaining Tasks, Modules, or Jobs.
- Set parameter: Sets a specific parameter when the condition is met. For example, if you configure a Change Service Parameters Task to restart a certain service on a number of Agents, this service can have a different name, depending on the operating system of the Agent. By letting the condition result specify the correct parameter value (for example, the Windows Firewall services SharedAccess or mpssvc), the Task will restart the correct service on each Agent.
To check the validity of the condition on your computer click Validate.
Execution
When Projects or Run Books are executed, all conditions will be evaluated, including Task and Module conditions. The Task details of a Job show information about (satisfied) conditions as they existed during execution of the Job.
- In Run Books, it is not possible to use parameter values from a CSV file in conditions based on parameters whose values are based on other parameters. See Using parameter values from a CSV file.
-
The use of Global Variables in Run Book parameters, Run Book conditions and Run Book evaluators is supported, but the used value will be the global value, not the value that the Global Variable can have per Agent/Team. This is due to the fact that Run Book jobs need to have the complete definition at schedule time, so the per-Agent/Team value cannot be used since we do not know for sure what are the Agents targeted by the job.
- The use of Parameters that get its value from a function (eg: a registry value data or IP address) in Run Book conditions is not supported. These conditions should be placed on the module or project level that is referenced in the Run Book job, or linked Parameters should be used to pass values from the module/project level to Run Book level.