Skip to main content

Property - Set

Summary

This script is intended to implement a solution to the multiple requests for exclusions in thresholds for targets. If a threshold for an item is set as a global property, there should be a way to override said policy at the computer level. This script addresses that request and is written in a manner so that it may be implemented in any Automate solution.

Sample Run

Sample Run Image 1
The above image sets a computer exclusion EDF to a new threshold, overwriting it if it currently exists.

Sample Run Image 2
The above image sets a global parameter to a value, overwriting it if it exists.

User Parameters

NameExampleRequiredDescription
ValueAnythingTrueThe value for the desired parameter
TypeGlobal or ComputerTrueThe type of parameter to create.
NameAnythingTrueThe name of the parameter to create.
Overwrite1 or anythingFalseToggles overwriting a currently set parameter.

Variables

NameDescription
ValidateChecks for the parameter; returns something or -9999 if missing.
dataValidateChecks for the specific computer parameter data; if missing, returns -9999 (used if setting computer parameter).
GUIDCreates a GUID for use with the computer parameter.
EFIDThe ID of the computer parameter.

Process

If Global is selected:

  • Check for the global parameter.
    • If the parameter is missing:
      • Create the parameter with the desired value.
    • If the parameter exists:
      • Check overwrite; if not 1, exit with an error. If 1, overwrite the current value.

If Computer is selected:

  • Check for the parameter and verify that the specific computer holds data in that parameter; if not, return -9999.
    • If a value is missing for that target:
      • Create the parameter for that target.
    • If a value is present for that target:
      • Check overwrite; if not 1, exit with an error; otherwise, overwrite the current target's parameter value.