Use the correct syntax for function names and arguments in Custom Inventory rules.
Conditional and Value Return rules use the following syntax:
For specific information on functions and their arguments see:
Enter the functionName followed by an opening parenthesis, enclose the arguments with a closing parenthesis. No spaces are allowed between the name of the function and the opening parenthesis.
Enter argument syntax for all rules except command and regex (regular expression) as follows:
• |
For example, the following syntaxes are the same:
For example, if the user want to test against the registry value in which the value name is "test,value", the user would need to escape the comma in this case because registry value name is not the last argument in the Custom Inventory (CI) function.
• |
An unmatched literal open parenthesis needs to be escaped as {{op}}. When the parser is tokenizing the arguments for the function, it counts the number of open and close parentheses to determine the end of the function and argument. Therefore, an unmatched literal open parenthesis would throw off the count, and cause the argument value to be parsed incorrectly. If a literal open parenthesis is needed as part of the argument value, it should be represented with {{op}}. |
For example, if the user wants to echo the string "Hello ( World", then the CI should look like the following:
If a literal close parentheses is needed as part of the argument value, it must be represented with {{cp}}.
For example, if the user wants to echo the string "Hello ) World", then the CI should look like the following:
You can write Custom Inventory rules that identify whether (true/false) an application is installed.
When using a conditional rule, if the rule returns true, the Display name (Title) of the custom application appears in the Software: Installed Programs section of the Device Detail page in the Inventory section.
The following sections describe the rules that test for conditions:
When the rule returns false, the application does not appear in the Installed Programs section in the device’s inventory details.
TIP: You can view a list of devices that have the item installed on the Inventory > Software > Custom_item: Detail page. |
The following table describes which data types can be used for comparison.
Data types supported for comparison functions Equals, GreaterThan, LessThan | |
The following table describes how comparisons are made.
For example, if the target value is 52a1, only 52 is evaluated. | |
For information on Equals, GreaterThan, and LessThan for FilenamesMatchingRegex, see Regular Expression Rule Reference.
Rules whose name ends with Exists check for the presence of a file, directory, registry key, or other item. If the KACE Agent locates the item on the device, the rule returns true, and the item appears in the device’s Inventory Details as an Installed Program.
Use any of the following Exists rules:
Example: Check for a directory (folder)
The following example tests whether the Windows directory exists on the device:
Rules whose name ends with Equals compare the value set on the device to the value you specify in the rule. The rules return true if the values exactly match.
Rules that use arguments with set data types can only compare values of the same type.
Use any of the following Equals rules:
Example: Testing JAVA_HOME setting
To verify that the JAVA_HOME setting is C:\Program Files\Java\jdk1.6.0_02:
Example: Testing McAfee® Registry Entry setting
To check the setting use the same format as the date in the entry:
Example: Detecting Windows 7 Service Pack 1
Windows 7 Service Pack 1 appears in Add/Remove programs for devices that were originally on Windows 7 then upgraded to SP1 only. The default application inventory for this item does not reflect devices that are already on SP1 because they were originally imaged at the SP1 level.
Functions whose names end with GreaterThan and LessThan compare values as listed in Table 24.
Use any of the following Greater Than and Less Than rules:
• |
FileVersionGreaterThan (path, version) and FileVersionLessThan (path, version) |
• |
ProductVersionGreaterThan (path, version) and ProductVersionLessThan (path, version) |
• |
FileInfoGreaterThan (fullpath, attribute, type, value) and FileInfoLessThan (fullpath, attribute, type, value) |
• |
RegistryValueGreaterThan (registryPath, valueName, value) and RegistryValueLessThan (registryPath, valueName, value) |
• |
EnvironmentalVariableGreaterThan (var, type, value) and EnvironmentalVariableLessThan (var, type, value) |
• |
PlistValueGreaterThan (fullpath, entry, type, value) and PlistValueLessThan (fullpath, entry, type, value) |
• |
FilenameMatchingRegexGreaterThan (fullpath, regex, value) and FilenameMatchingRegexLessThan (fullpath, regex, value) |
Example: Testing whether the product version is higher
To verify that the product version is higher than a given number:
To verify that the production version is a given number or higher, enter the following:
Example: Testing for a product version range
To test whether the product version is within a range, combine less than and greater than rules:
You can join rules using AND operators or OR operators to test for multiple conditions.
Joining conditional rules produces the following results:
In the Custom Inventory Field, join rules using the following syntax:
Separate the conditional statements from the operator with spaces.
Example: Checking for a registry key and comparing values
When you join rules using the OR operator, if any of the rules in the Custom Inventory Field are true, the application appears in the Installed Program list of the device.
In the Custom Inventory Field, join the rules using the following syntax:
Separate the function statements and operator using a space.
Example: Checking for either registry value
To check that a registry entry is one value or another:
TIP: To specify a range use RegistryValueGreaterThan and RegistryValueLessThan rules joined by the AND operator. |
The rules that end with ValueReturn enable you to gather information from the device. You can use these rules to collect information that the KACE Agent normally does not collect.
The returned values are set with the custom application display name (Title). This appears on the Device Detail page under Software in Installed Programs and Custom Inventory Fields.
Use the Custom Inventory Field values to manage installations and to distribute software as well as reports, View By filtering, Smart Label search criteria, or any other process that can be performed with an automatically detected setting.
This section covers the following topics:
The following table shows all available value return rules that you can use to set a Custom Inventory Field :
You can set the Custom Inventory Field to any of the Windows File Information attributes using the FileInfoReturn rule.
Example: Getting Mozilla Firefox version
The following example sets the Custom Inventory Field for the Mozilla Firefox Product Version as a NUMBER:
In the Custom Inventory Field, enter the following:
You can set the Custom Inventory Field to a registry key using the RegistryValueReturn rule. Where the registryPath (on left) is the path to the entry, the valueName (on right) is the key you want to return.
Example: Getting the Mozilla FireFox CurrentVersion key
To set the CurrentVersion registry key as a Custom Inventory Field:
Command rules enable you to set the output of a command to a Custom Inventory Field. The command depends on the command interpreter and executable path on the device.
Use any of the following rules to set the output of the command to a Custom Inventory Field:
Example: Getting uptime on a Mac OS X
To set the uptime as a Custom Inventory Field:
PlistValueReturn rules enable you to set a Property List (PList) key as a Custom Inventory Field.
Example: Getting the system locale
Join ValueReturn rules using either the AND or OR operator. The rule shows the application as an Installed Program, if any of the values are not empty.
The joined values are all set in the same Custom Inventory Field separated by the operator and therefore are technically considered for the purposes of Search Criteria, filters, reports, and other appliance processes as TEXT.
ValueReturn rules joined by the:
• |
AND operator: All the values are reported in the Custom Inventory Field. |
• |
OR operator: All values are reported in the Custom Inventory Field. |
In the Custom Inventory field, join rules using the following syntax:
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Termini di utilizzo Privacy Cookie Preference Center