Already a NinjaOne customer? Log in to view more guides and the latest updates.

NinjaOne Policies: Compound Conditions

Topic

This article discusses how to configure compound conditions in NinjaOne.

Environment

NinjaOne Endpoint Management

Description

Compound conditions allow technicians to combine multiple conditions for more precise device targeting and monitoring. This option lets you apply multiple conditions to define precise conditions in which alerts trigger or NinjaOne takes action based on configurations.

You must set conditions at the policy level, which allows you to monitor your systems with minimal configuration. When compound conditions meet the configured criteria, such as combining a custom field and a script result, NinjaOne can assign severity and priority levels, send notifications to specific recipients, run automations, or create a ticket. Learn more about policy-level conditions at NinjaOne Policies: Condition Configuration.

Compound Conditions (NinjaOne, Inc., 01:39)

Index

Select a topic to continue.

How Compound Condition Configuration Works

When adding a compound condition, you can create the following types:

Compound condition typeDescription or purpose
Script result conditionThe script result condition lets you run an evaluation script on devices at specified intervals. The condition matches the script's output against the criteria you specify. Criteria are case-sensitive, and the condition checks for an exact match.
Custom fieldsThe custom field condition evaluates a field value against conditions you specify; the value must meet all conditions or any condition specified. For example, if a custom field value must meet "ALL" conditions, it will not trigger if the custom field value fails to meet one or more of the provided conditions. If a custom field value must meet "ANY" condition, it will trigger if at least one of the conditions is met.
SoftwareThis condition triggers based on whether a specified software application exists or does not exist on the managed device. NinjaOne supports wildcards of "*" (asterisk) for software. For example, "*adobe" or "*firefox*".
Operating systemThis condition triggers only when the device is running the specified operating system.
Windows Service (Windows OS policies only)This condition triggers based on whether a specified service exists or does not exist, is "up" or "down," disabled, or set as automatic on the managed device. Manually added services must be based on the service name, not the service display name. NinjaOne supports one wildcard of "*" (asterisk) at the beginning or end of the service name.
Daemon (macOS and Linux policies only)Use this condition to trigger based on the presence and state of daemons on the endpoint. You can manually enter the name of the daemon or select multiple daemons from a drop-down menu. One wildcard of "*" (asterisk) is supported at the beginning or end of the service name.
ProcessUse this condition to trigger based on whether one or more processes are running. NinjaOne supports wildcards of * for process names. For example, *adobe or *firefox*.
File or folderUse this condition to determine whether a specified file path or folder is present or missing. NinjaOne supports multiple wildcards within the string for either folder or file.
Windows role or feature (Windows OS policies only)Use this condition to detect whether the endpoint has a specific Windows role or feature installed.
Windows RegistryThis condition triggers based on the presence, absence, or value of a registry key on the managed device. Use it to detect configuration drift, verify device setup, or monitor specific registry values.

You can add automations or configure notifications that will initiate when the compound condition triggers. Additionally, configure settings that automatically reset the condition after a specified amount of time or run the condition on a schedule.

The Compound Conditions section in the NinjaOne policy provides a search filter so you can find a specific condition based on name or status (active or inactive).

Technician Permissions for Compound Conditions

You must grant the technician permission to access and manage compound conditions. System administrators have access by default.

Technicians must have a minimum permission Default Access of "View, Update" for Policies in their account or role.

policies_default access_view, update.png
Figure 1: Default access permission for policies in NinjaOne (click to enlarge)

To learn more about permissions, refer to User Permissions: Permission Options. To learn more about roles, refer to User Roles and Permissions.

Create a Compound Condition

To create a new compound condition, perform the following steps:

  1. In NinjaOne, navigate to Administration → Policies → Agent Policies and select the policy.
40391697495437_policy-editor-nav-conditions-Nav_annotated.png
Figure 2: Administration → Policies → Agent Policies (click to enlarge)

The Policy Editor will open.

  1. Click ConditionsAdd condition and select Compound condition from the drop-down menu.
40391697495437_NavToNewCompoundCondition.png
Figure 3: Conditions → Add condition and select Compound condition (click to enlarge)

The Add a compound condition dialog will appear.

  1. The Conditions section of the modal is open by default. Click Add condition and then select an option from the drop-down menu. If you add more than one condition, a Trigger When option appears at the top of the Conditions list. For information about this setting, see Trigger the Compound Condition.
add a compound condition_select condition type.png
Figure 4: Add a compound condition type (click to enlarge)

Depending on the condition type you select, your configuration options will vary. Refer to the following sections to find instructions specific to your compound condition type.

Create a Script Result Condition

To create a script result compound condition, perform the following steps:

  1. Select Script result condition from the Add condition drop-down menu.
  2. Next to Evaluation script, click Add. Select an evaluation script to run on devices at the interval specified in the compound condition setting.
  3. For Result code, select an option from the drop-down menu and then use the minus (-) and plus (+) sign buttons to create a threshold.
    • In the context of a script result condition, a result code is a number that an application or script returns when it finishes running. This number indicates whether the execution was successful or if a problem occurred.
A successfully completed script typically returns a result code of "0." If an error occurs, it may return "1," "15," or another number depending on the situation. Some scripts use specific result codes to signal particular conditions; for instance, a script that checks for a file might return "20" if the file is not present or "21" if the file is present but cannot be read. Ultimately, result codes provide a measurable indication of success, or the type of failure encountered during execution.
  1. For Timeout, use the minus (-) and plus (+) sign buttons to determine the amount of time the script is allowed to run. If the running duration hits the specified amount of time, NinjaOne forcibly terminates the script.
  2. For Output, select an option from the drop-down menu and then add text that is logically consistent with the selected probe script. The condition matches the script's output against the criteria you specify.
    • Select the Include script output in final alert checkbox under this field to see the actual script results when the system alerts you. NinjaOne will include any script output in the final alert or activity note.
    • In the context of a script result condition or any program that executes, output refers to the information that the script or application returns when it finishes running. This can include text, numbers, or structured data that indicate what the script performed or found during execution.
A script that checks disk space might display the output, "Free space: 10GB," or a script that reads a file might output the file's contents. Output is often used to confirm that a script completed its intended task and provide details that can be used for further processing, validation, or troubleshooting.
  1. Select the checkbox in the Script error notification section to send an error notification email to technicians if the result code meets the set criteria. Then, select the criteria that need to be met in the drop-down menu. Use the minus (-) and plus (+) sign buttons to set the threshold for the number of script errors.
    • Example use of this field: If Script error notification is set to "equal to" and "1," the technician receives an error notification any time the script returns a result code of 1.
  2. Click Apply.

Create a Custom Fields Condition

To create a custom field compound condition, perform the following steps:

  1. Select Custom fields from the Add condition drop-down menu.
  2. Next to Custom field value must meet ALL conditions or Custom field value must meet ANY conditions, click Add.
You can add conditions for both "ALL" and "ANY," but it is not required.
compound custom field condition_add.png
Figure 5: Add custom fields condition (click to enlarge)
  1. Two drop-down menus will appear when you click Add; select an option from each menu.
  2. Depending on your selection in the first drop-down menu, the criteria in the second drop-down menu will change, and additional data fields may appear. The resulting data fields depend on how you set up the custom field and the information it requires. To learn more about custom field setup, refer to Custom Field Setup.
For example, if you select "Schedule" from the first drop-down menu, you must then provide a calendar date and time. If you select "Full Name of End User," you must provide text that is relevant to the end user's name, such as "contains" their first or last name or "does not equal" any part of their name. An example of triggering a condition based on a name would be to receive a notification if the name on a device does not match the name of the assigned owner.
  1. Click Add again to include more criteria.
  2. Click Apply.
example of a compound custom field condition.png
Figure 6: Example of a custom field condition (click to enlarge)

Create a Software Condition

To create a software compound condition, perform the following steps:

  1. Select Software from the Add condition drop-down menu.
  2. Select the software from the top drop-down menu or type the name of the software into this field. If you type in a name, press Enter on your keyboard to save it. You can select multiple software programs.
  3. Select the values that will trigger the condition in the Trigger when drop-down menu.
  4. Click Apply.
example of compound software condition.png
Figure 7: Add software condition (click to enlarge)

Create an Operating System Condition

To create an operating system compound condition, perform the following steps:

  1. Select Operating System from the Add condition drop-down menu.
  2. Select the value that will trigger for the specified OS. The OS can be present ("equal to" or "contains") or absent ("not equal to" or "does not contain") on the device. The "equal" values will match the full name of the OS, whereas the "contain" values will match part of the name (for example, "contains" or "does not contain" will trigger if an OS was misspelled or incomplete).
  3. In the Select or add an OS field, select or type an operating system. You may use an * before or after the operating system as a wildcard.
  4. Click Apply.
compound conditions_OS.png
Figure 8: Add operating system condition (click to enlarge)

Create a Windows Service Condition

To create a Windows service compound condition, perform the following steps:

  1. Select Windows Service from the Add condition drop-down menu.
  2. Select the service(s) from the top drop-down menu or type the name of the service into this field. If you type in a name, press Enter on your keyboard to save it. You can select multiple services.
Manually added services must be based on the service name, not the service display name. One wildcard (*) is supported at the beginning or end of the service name.
  1. Select the value that will trigger the condition in the Trigger when drop-down menu.
    • If you select "Up" or "Down" from the second Trigger when drop-down menu, the Duration fields appear in the dialog (refer to Figure 10 for illustration). Define the duration the service must remain in the selected state to trigger the condition.
  2. Click Apply.
compound conditions_windows service.png
Figure 9: Add Windows service condition (click to enlarge)

Create a Daemon Condition

To create a daemon compound condition, perform the following steps:

  1. Select Daemon from the Add condition drop-down menu.
  2. Type the name of the daemon into the daemon name field. On macOS policies, this field is labeled Mac Daemons. Press Enter on your keyboard to save it. You can select multiple daemons.
Manually added daemons must be based on the service name, not the service display name. One wildcard (*) is supported at the beginning or end of the service name. The field label may differ on Linux policies.
  1. Select the value that will trigger the condition in the Trigger when drop-down menu.
    • If you select "Up" or "Down" from the second Trigger when drop-down menu, the Duration fields appear in the dialog (refer to Figure 10 for illustration). Specify the duration for which the service must remain selected to trigger the condition.
  2. Click Apply.
compound conditions_daemon.png
Figure 10: Add daemon condition (click to enlarge)

Create a Process Condition

To create a process compound condition, perform the following steps:

  1. Select Process from the Add condition drop-down menu.
  2. Type the name of the process into the Process name field. Press Enter on your keyboard to save it. You can select multiple processes.
  3. Select the value that will trigger the condition in the Trigger when drop-down menu.
  4. Click Apply.
compound conditions_process.png
Figure 11: Add process condition (click to enlarge)

Create a Windows Role or Feature Condition

To create a Windows role or feature compound condition, perform the following steps:

  1. Select Windows role or feature from the Add condition drop-down menu.
  2. From the Feature/Display name drop-down menu, select from the list of available roles and features. If the name of a role or feature is not listed, you can manually type it into the space; press Enter on your keyboard to save the entry.
  3. Select the value that will trigger the condition in the Trigger when drop-down menu.
  4. Click Apply.
compound conditions_windows role.png
Figure 12: Add Windows role or feature condition (click to enlarge)

Create a File or Folder Condition

To create a file or folder compound condition, perform the following steps:

  1. Select File or folder from the Add condition drop-down menu.
  2. In the File or folder path field, enter the full path of the file or folder you want to monitor. You can use up to two wildcards (*) anywhere within the path (consecutive wildcards are not allowed).
  3. Select the value that will trigger the condition in the Trigger when drop-down menu.
  4. Click Apply.

Create a Windows Registry Condition

To create a Windows Registry compound condition, select Windows Registry from the Add condition drop-down menu, then enter the following information. When finished, click Apply to save the condition. This condition type uses reference tables rather than numbered steps because its configuration varies depending on the condition type you select.

Select a Condition Type

Select one of the following condition trigger options:

  • Existence check: Trigger based on whether the registry key is present or absent on the device. If you choose this setting, you must select an operator value. See the Existence Check Settings table in this section for a description of each setting.
  • Value comparison: Triggers based on the data stored in a specified registry value. If you choose this setting, you must enter additional information for your comparison. Refer to the Value Comparison Settings table in this section for a description of each setting.
Existence Check Settings
WindowsRegistryCondition_AddConditionModal.png
Figure 13: Add an Existence check Windows registry condition (click to enlarge)
SettingDescription
Key path

The registry key path requires the hive (root key), key, and subkeys. Do not include the registry value. Only the following hives are currently supported (uppercase only):

  • HKEY_CLASSES_ROOT (HKCR)
  • HKEY_LOCAL_MACHINE (HKLM)
  • HKEY_USERS (HKU)
  • HKEY_CURRENT_CONFIG (HKCC)

For example: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPolicies

Operator

If you selected Existence check as the condition type, select the value that will trigger the condition. Choose from the following options to trigger the condition:

  • Key exists: The specific registry key is present on the device.
  • Key does not exist: The specific registry key is absent on the device.
  • Value name exists: A specifically named value is present in the key. Enter the name of the registry value in the Value name field.
  • Value name does not exist: A specifically named value is absent in the key. Enter the name of the registry value in the Value name field.
Value Comparison Settings
WindowsRegistryCondition_ValueComp.png
Figure 14: Add a Value comparison Windows registry condition (click to enlarge)
SettingDescription
Registry value type

Select the data type of the registry value you want to evaluate:

  • REG_SZ: A fixed-length string value.
  • REG_EXPAND_SZ: A variable-length string value that may contain references to environment variables, such as %SystemRoot%.
  • REG_MULTI_SZ: A sequence of null-terminated strings, used when a registry value contains multiple strings.
  • REG_DWORD: A 32-bit integer value.
  • REG_QWORD: A 64-bit integer value.
OperatorSelect the comparison to apply. The available operators change based on the registry value type you selected.
BaseSelect the counting system the value uses. You can choose Hexadecimal or Decimal.
Value DataIf you selected an operator other than Exists or Does not exist, enter the expected value in this field.

Trigger the Compound Condition

When adding multiple conditions to a compound condition, you'll see a Trigger When drop-down menu with two options:

  • any condition is true: Conditions will be evaluated sequentially from top to bottom. If one or more conditions evaluate to true, the evaluation stops immediately and the compound condition triggers. This prevents unnecessary checks on the endpoint, helping maintain performance.
If you have 15 script result conditions and the first condition evaluated meets the required criteria, the remaining 14 conditions won't be evaluated, but the compound condition will trigger.
  • all conditions are true: Conditions will be evaluated sequentially from top to bottom, and every condition must be met for the compound condition to trigger. If any condition fails during evaluation, the process stops immediately. Keep in mind that evaluating numerous or complex conditions frequently can impact performance.
For example, if you have five conditions and the third condition evaluated doesn't meet the required criteria, the remaining two conditions won't be evaluated, and the compound condition will not trigger.

This option requires at least two conditions.

compound condition_trigger when.png
Figure 15: Options for triggering the compound condition (click to enlarge)

Add Automations to a Compound Condition

To add an automation to run when your compound condition is triggered, perform the following steps:

  1. Open the Automations tab within the configuration dialog, and then click Add automation.
compound condition_add automation.png
Figure 16: Add automation (click to enlarge)

The Automation Library will open, displaying a list of available automations.

  1. Locate and select your script using the filters at the top of the dialog. Select additional automations as needed.
  2. Click Apply.

Apply Condition Settings to a Compound Condition

To apply additional condition settings, perform the following steps:

  1. Open the Settings tab within the compound condition configuration dialog.
  2. Enter a name for your compound condition.
  3. Use the following table to configure the fields.
Field nameDescription or purpose
Auto Reset AfterThe condition resets and can trigger again after the specified time.
When no longer metThe condition resets when the values are no longer met.
Run EveryThe condition runs at the specified interval.
Trigger uptimeThe condition won't trigger until the device has been running for at least the specified amount of time. You can use this option to prevent alerts while a device is starting up its programs and services.
  1. Click Apply.
compound condition_settings.png
Figure 17: Configure compound condition settings (click to enlarge)

Add Ticketing Rules and Notifications to a Compound Condition

To configure ticketing rules and notifications, perform the following steps:

  1. Open the Notifications tab within the configuration dialog.
  2. Use the following table to configure the fields.
Field nameDescription or purpose
SeverityThe severity indicates the impact of the triggered condition on the affected device or system.
PriorityThe priority defines the order in which you should address the triggered condition.
Notify TechniciansSelect whether you want technicians to receive a notification when the condition is triggered.
Notify on resetSelect whether you want technicians to receive a notification when the condition is reset. You must configure the condition to reset in the Settings section for this option to perform as expected.
ChannelsSelect the channels through which technicians receive the notification. 
Ticketing RuleThis option allows you to create a ticket from the triggered condition. The ticketing options may vary or may not be available if NinjaOne Billing or NinjaOne Ticketing is not active with your system configuration. To learn more about ticketing in NinjaOne, refer to Ticketing: Resource Catalog.
  1. Click Apply.
compound condition_notifications.png
Figure 18: Configure notifications and ticketing rules (click to enlarge)

Additional Resources

To learn more about policies in NinjaOne, refer to NinjaOne Policies: Condition Configuration.

FAQ

Next Steps