SetCfgValue() action

The SetCfgValue action enables a configuration value to be updated from an expression rule. This action can be run from any expression rule type and executes for the asset in the current context. The action returns Void.

Operating on the asset in scope

Updates the configuration value corresponding to the specified Path for the asset in the rule execution context with the specified value.

Format:

Void SetCfgValue("path", "value")

where:

path -- String with max length of 256 chars consisting of CharSet3

value-- String with length of 256 chars consisting of any character

Operating on a specified asset

Format:

Void SetCfgValue("path", "value", "modelNumber", "serialNumber")

where:

path -- String with max length of 256 chars consisting of CharSet3

value-- String with length of 256 chars consisting of any character

modelNumber -- The model of the asset configuration (Path) for this operation

serialNumber-- The serial number of the asset configuration (Path) for this operation

Example:

The following example determines if less than 3 configuration items are defined in the specified Path for the asset in scope. If so, an Audit message is created.

IF:   CfgHas("/Config/Hardware/MotherBoard/Make", "Asus", "none") &&

      CfgHas("/Config/Hardware/MotherBoard/Model", "123", "all") &&

      CfgDoubleValue("/Config/Software/OS/Version") < 7

THEN: SetCfgValue("/Config/Software/OS/Version", "6.0")

ELSE: Audit("data-management", "Configuration was valid")