Microsoft.Windows.RegistryProvider

Applies To: Operations Manager 2007 R2

The Microsoft.Windows.RegistryProvider module is a data source module type that queries the Windows registry at a scheduled frequency and returns the results as Microsoft.Windows.RegistryData type data.

Usage

Use this module when you want to query the Windows registry and return the data within a workflow such as a rule or monitor. This module supports retrieving any key or value from the HKEY_LOCAL_MACHINE hive of the registry only. For multi-string values, only the first string is returned.

Type Definition

<DataSourceModuleType ID="Microsoft.Windows.RegistryProvider" Accessibility="Public">
  <Configuration>
    <IncludeSchemaTypes>
      <SchemaType>Microsoft.Windows.RegistryAttributeDefinitionsSchema</SchemaType>
    </IncludeSchemaTypes>
    <xsd:element name="ComputerName" type="xsd:string" />
    <xsd:element name="RegistryAttributeDefinitions" type="RegistryAttributeDefinitionsType" />
    <xsd:element name="Frequency" type="xsd:unsignedInt" />
  </Configuration>
  <OverrideableParameters>
    <OverrideableParameter ID="Frequency" Selector="$Config/Frequency$" ParameterType="int" />
  </OverrideableParameters>
  <ModuleImplementation>
    <Composite>
      <MemberModules>
        <DataSource TypeID="System!System.Scheduler" ID="Scheduler">
          <Scheduler>
            <SimpleReccuringSchedule>
              <Interval Unit="Seconds">$Config/Frequency$</Interval>
            </SimpleReccuringSchedule>
            <ExcludeDates />
          </Scheduler>
        </DataSource>
        <ProbeAction TypeID="Microsoft.Windows.RegistryProbe" ID="Probe">
          <ComputerName>$Config/ComputerName$</ComputerName>
          <RegistryAttributeDefinitions>$Config/RegistryAttributeDefinitions$</RegistryAttributeDefinitions>
        </ProbeAction>
      </MemberModules>
      <Composition>
        <Node ID="Probe">
          <Node ID="Scheduler" />
        </Node>
      </Composition>
    </Composite>
  </ModuleImplementation>
  <OutputType>Microsoft.Windows.RegistryData</OutputType>
</DataSourceModuleType>

Parameters

The Microsoft.Windows.RegistryProvider module supports the configuration parameters described in the following table.

Parameter Type Overrideable Description

ComputerName

String

False

Required parameter. The name of the computer from which to query the registry.

RegistryAttributeDefinitions

RegistryAttributeDefinitionsType

False

Required parameter. The set of keys and values to gather from the registry.

Frequency

Unsigned Integer

True

Required parameter. Specifies the frequency, in seconds, at which to run the query over the registry.

For more information about the ComputerName parameter, see the Microsoft.Windows.RegistryProbe module.

For more information about the RegistryAttributeDefinitions parameter, see RegistryAttributeDefinitionsType.

For more information about the Frequency parameter, see the System.Scheduler module.

Composition

The Microsoft.Windows.RegistryProvider module is a composite module that contains the member modules described in the following table.

Workflow Run Order Module Type Usage

1

System.Scheduler

Triggers the subsequent probe module to run at a scheduled, recurring interval.

2

Microsoft.Windows.RegistryProbe

Runs the query on the Windows registry and returns Microsoft.Windows.RegistryData data.

Module Type Usage

Microsoft.Windows.Discovery.RegistryProviderSingle

Queries a single Windows registry value or key and returns Microsoft.Windows.RegistryData data.

Microsoft.Windows.Discovery.RegistryProvider

Queries Windows registry keys or values and returns Microsoft.Windows.RegistryData data. This should be used only from within a data source module type definition that returns discovery data.

Microsoft.Windows.Discovery.RegistryProviderSingle

Queries a single Windows registry key or value and returns Microsoft.Windows.RegistryData data. This type has simpler configuration, but only a single value or key can be specified. This should be used only from within a data source module type definition that returns discovery data.

Microsoft.Windows.FilteredRegistryDiscoveryProvider

Queries the Windows registry on a timed interval and returns System.Discovery.Data data. This type takes an expression to filter data on.

Microsoft.Windows.RegistryDiscoveryProvider

Queries the Windows registry and returns System.Discovery.Data data. No filtering of data is provided in this module type. This should be used only when you know that the registry keys and values will always be present.

Microsoft.Windows.RegistryDiscoverySingleProvider

Queries the Windows registry for a single key or value and returns System.Discovery.Data data. No filtering of data is provided in this module type. This should be used only when you know that the registry keys and values will always be present.

External Module References

None.

Sample

The following XML sample shows an example of a rule that runs every 24 hours. The rule uses the registry provider module to return a set of values from the registry, map them to System.Event.Data, and write the event to the database:

<Rule ID="Microsoft.Samples.RegistryProvider.GetAppSettings" Enabled="true" Target="Windows!Microsoft.Windows.Client.Computer"  Remotable="true">
  <Category>Custom</Category>
  <DataSources>
    <DataSource ID="RegistryData" TypeID="Windows!Microsoft.Windows.RegistryProvider">
     <ComputerName>$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/NetworkName$</ComputerName>
      <RegistryAttributeDefinitions>
       <RegistryAttributeDefinition>
        <AttributeName>ApplicationXExists</AttributeName>
        <Path>SOFTWARE\OpsMgrSamples\ApplicationX</Path>
        <PathType>0</PathType>
        <AttributeType>0</AttributeType>
       </RegistryAttributeDefinition>
       <RegistryAttributeDefinition>
        <AttributeName>ApplicationXVersion</AttributeName>
        <Path>SOFTWARE\OpsMgrSamples\ApplicationX\Version</Path>
        <PathType>1</PathType>
        <AttributeType>1</AttributeType>
       </RegistryAttributeDefinition>
       <RegistryAttributeDefinition>
        <AttributeName>ApplicationXPath</AttributeName>
        <Path>SOFTWARE\OpsMgrSamples\ApplicationX\Path</Path>
        <PathType>1</PathType>
        <AttributeType>1</AttributeType>
       </RegistryAttributeDefinition>
     </RegistryAttributeDefinitions>
     <Frequency>86400</Frequency>
    </DataSource>
  </DataSources>
  <ConditionDetection TypeID="System!System.Event.GenericDataMapper" ID="Mapper">
     <EventOriginId>$Target/Id$</EventOriginId>
     <PublisherId>$MPElement$</PublisherId>
     <PublisherName>ApplicationXRegistryProvider</PublisherName>
     <Channel>Application</Channel>
     <Description>ApplicationX is currently installed on the system (Version: %1, Path: %2).</Description>
     <EventNumber>0</EventNumber>
     <EventCategory>3</EventCategory>
     <EventLevel>0</EventLevel>
     <UserName />
     <Params>
        <Param>$Data/Property[@Name=’ApplicationXVersion’]$</Param>
        <Param>$Data/Property[@Name='ApplicationXPath']$</Param>
     </Params>
  </ConditionDetection>
  <WriteActions>
    <WriteAction ID="WriteToDB" TypeID="SCLibrary!Microsoft.SystemCenter.CollectEvent"/>
  </WriteActions>
</Rule>

Information

   

Module Type

DataSourceModuleType

Input Type

None

Output Type

Microsoft.Windows.RegistryData

Implementation

Composite

Library

Microsoft.Windows.Library