Context parameters are variables that you can use in a Management Pack's XML file or in a custom runtime script that is added to a Management Pack. Context parameters allow you to reference runtime data for specific objects in the Management Pack. For example, you can reference the globally unique identifier of a class instance that is targeted by a rule.

Whether a context parameter is used in a Management Pack or in a runtime script, it must be nested between opening and closing dollar symbols ($) as shown in the following example:

$MPElement$

The following table describes the available context parameters that you can use in a Management Pack or in a runtime script.

Context Parameter Description

$MPElement$

Provides the globally unique identifier (GUID) of the monitoring object (that is, discovery, monitor, rule, or task) in which the context parameter is used.

$MPElement[Name='ElementName']$

References an element in the current Management Pack by name, as in the following example:

$MPElement[Name='Microsoft.Demo.Scripting.AppY']$

$MPElement[Name = 'MPAlias!ElementName']$

References an element in a referenced Management Pack by name, as in the following example:

$MPElement[Name='Windows!Microsoft.Windows.Computer']$

$Target/Id$

Provides the GUID of the class instance that is targeted by the current monitoring object.

$Target/ManagementGroup/Id$

Provides the GUID of the Management Group to which the class instance that is targeted by the current monitoring object belongs.

$Target/ManagementGroup/Name$

Provides the name of the Management Group to which the class instance that is targeted by the current monitoring object belongs.

$Target/Property[Type='ClassName']/PropertyName$

References a property of the class instance that is targeted by the current monitoring object. Use this syntax when the property is defined in the current Management Pack, as in the following example:

$Target/Property[Type='Microsoft.Demo.Scripting.AppXComponent']/FileName$

$Target/Property[Type='MPAlias!ClassName']/PropertyName$

References a property from a parent class of the target class instance. Use this syntax when the property is defined in a referenced Management Pack, as in the following example:

$Target/Property[Type='Windows!Microsoft.Windows.Computer']/PrincipalName$

$Target/Host/Property[Type='ClassName']/PropertyName$

$Target/Host/Host/…/Property[Type='ClassName']/PropertyName$

References a property of any host of the class instance that is targeted by the current monitoring object. Use this syntax when the property is defined in the current Management Pack. Replace the ellipsis (…) with the appropriate number of Host keywords to navigate to any instance in the hosting hierarchy, as in the following example:

$Target/Host/Property[Type='Microsoft.Demo.Scripting.AppX']/Path$

$Target/Host/Property[Type='MPAlias!ClassName']/PropertyName$

$Target/Host/Host/…/Property[Type='MPAlias!ClassName']/PropertyName$

References a property of any host of the class instance that is targeted by the current monitoring object. Use this syntax when the property is defined in a referenced Management Pack. Replace the ellipsis (…) with the appropriate number of Host keywords to navigate to any instance in the hosting hierarchy, as in the following example:

$Target/Host/Property[Type='Windows!Microsoft.Demo.Scripting.AppX']/Path$

$Config/XPathExpression$

References a parameter that is defined in the configuration of a monitor or module type. This is used only for defining composites. The XPath expression must be defined relative to the <Configuration> element. For example, if a Configuration element is defined as follows:

  Copy Code
<Configuration>
  <xsd:element name="IntervalSeconds" type="xsd:integer"/>
</Configuration>

a parameter can reference the element's value as follows:

  Copy Code
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>

$Data/XPathExpression$

References a data item (for example, a name-value pair that is stored in a MOMPropertyBag object). The XPath expression to reference a data item depends on the item's type. The following examples show data item references that include XPath expressions:

$Data/EventDisplayNumber$

$Data/PublisherName$

$Data/Params/Param[1]$

See Also


Send comments about this topic to Microsoft.
[an error occurred while processing this directive]