Microsoft.Windows.ExistingWin32ServiceInformationProbe[]

Applies To: Operations Manager 2007 R2

The Microsoft.Windows.ExistingWin32ServiceInformationProbe probe action module type is used to query installed Windows service information from the Service Control Manager. A module of this type takes a trigger as input, which means it can accept any data type to trigger execution. The module returns a System.PropertyBagData type that contains all the properties of the service.

Usage

Use this module to provide information regarding a specific installed Win32 service in the context of a workflow.

Type Definition

<ProbeActionModuleType ID="Microsoft.Windows.ExistingWin32ServiceInformationProbe" Accessibility="Public">
  <Configuration>
    <IncludeSchemaTypes>
      <SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
    </IncludeSchemaTypes>
    <xsd:element name="ComputerName" type="xsd:string" />
    <xsd:element name="ServiceName" type="xsd:string" />
  </Configuration>
  <ModuleImplementation>
    <Composite>
      <MemberModules>
        <ProbeAction TypeID="Microsoft.Windows.Win32ServiceInformationProbe" ID="Probe">
          <ComputerName>$Config/ComputerName$</ComputerName>
          <ServiceName>$Config/ServiceName$</ServiceName>
        </ProbeAction>
        <ConditionDetection TypeID="System!System.ExpressionFilter" ID="Filter">
          <Expression>
            <And>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Integer">Property[@Name='State']</XPathQuery>
                  </ValueExpression>
                  <Operator>NotEqual</Operator>
                  <ValueExpression>
                    <Value Type="Integer">8</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
              <Expression>
                <SimpleExpression>
                  <ValueExpression>
                    <XPathQuery Type="Integer">Property[@Name='State']</XPathQuery>
                  </ValueExpression>
                  <Operator>NotEqual</Operator>
                  <ValueExpression>
                    <Value Type="Integer">9</Value>
                  </ValueExpression>
                </SimpleExpression>
              </Expression>
            </And>
          </Expression>
        </ConditionDetection>
      </MemberModules>
      <Composition>
        <Node ID="Filter">
          <Node ID="Probe" />
        </Node>
      </Composition>
    </Composite>
  </ModuleImplementation>
  <OutputType>System!System.PropertyBagData</OutputType>
  <TriggerOnly>true</TriggerOnly>
</ProbeActionModuleType>

Parameters

The Microsoft.Windows.ExistingWin32ServiceInformationProbe module supports the following configuration parameters:

Parameter Type Description

ComputerName

String

The name of the computer to query.

ServiceName

String

The service name to query.

For information about the ComputerName and ServiceName parameters, see Microsoft.Windows.Win32ServiceInformationProbe.

Composition

The Microsoft.Windows.ExistingWin32ServiceInformationProbe module is a composite module that contains the following member modules:

Workflow Run Order Module Type Usage

1

Microsoft.Windows.Win32ServiceInformationProbe

Queries Windows service information from the Service Control Manager and returns System.PropertyBagData data.

2

System.ExpressionFilter

Filters out the data that contains the “Service Not Found” (8) state.

Module Type Usage

Microsoft.Windows.NTServiceStateProvider

Provides the state information of a specific Windows NT service.

External Module References

None.

Remarks

The module outputs a property bag object that contains data about the service that was queried. The following code example shows an example data item:

<DataItem type="System.PropertyBagData" time="2008-10-08T15:52:27.0027578-07:00" sourceHealthServiceId="B0BE86FA-56AD-1F2E-EE87-8DF72FC53818">
  <Property Name="State" VariantType="3">4</Property>
  <Property Name="ServiceType" VariantType="3">16</Property>
  <Property Name="StartMode" VariantType="3">2</Property>
  <Property Name="ErrorControl" VariantType="3">1</Property>
  <Property Name="TagId" VariantType="3">0</Property>
  <Property Name="ProcessId" VariantType="3">1880</Property>
  <Property Name="Name" VariantType="8">MSSQLSERVER</Property>
  <Property Name="BinaryPathName" VariantType="8">"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\sqlservr.exe" -sMSSQLSERVER</Property>
  <Property Name="LoadOrderGroup" VariantType="8"></Property>
  <Property Name="Dependencies" VariantType="8"></Property>
  <Property Name="ServiceStartName" VariantType="8">LocalSystem</Property>
  <Property Name="DisplayName" VariantType="8">SQL Server (MSSQLSERVER)</Property>
  <Property Name="Description" VariantType="8">Provides storage, processing and controlled access of data and rapid transaction processing.</Property>
</DataItem>

The data item is a property bag that contains the following properties:

Property Description

State

The current service status. Possible values are:

  • 0 - Unknown

  • 1 - Stopped

  • 2 – Start pending

  • 3 – Stop pending

  • 4 - Running

  • 5 – Continue pending

  • 6 – Pause pending

  • 7 - Paused

  • 8 – Service not found

  • 9 – Server not found

ServiceType

The type of service. Possible values are:

  • 1 – Kernel/driver

  • 2 – File system driver

  • 16 – Own process

  • 32 – Share process

StartMode

The startup type of the service. Possible values are:

  • 0 – Boot start

  • 1 – System start

  • 2 - Automatic

  • 3 - Manual

  • 4 - Disabled

ErrorControl

Severity of the error and the action taken if the service fails to start. Possible values are:

  • 0 - The startup (boot) program logs the error but continues the startup operation.

  • 1 - The startup program logs the error and displays a message but continues the startup operation.

  • 2: The startup program logs the error. If the last-known good configuration is being started, the startup operation continues. Otherwise, the system is restarted with the last-known-good configuration.

  • 3 - The startup program logs the error, if possible. If the last-known good configuration is being started, the startup operation fails. Otherwise, the system is restarted with the last-known good configuration.

TagID

Unique tag value for this service in the group that is specified by the lpLoadOrderGroup parameter. A value of zero indicates that the service has not been assigned a tag.

ProcessID

The current process ID for the service. This is 0 if the service is not currently running.

Name

The short service name, for example: MSSQLSERVER

BinaryPathName

The path to the executable file for the service, including startup parameters.

LoadOrderGroup

Pointer to a null-terminated string that names the load ordering group to which this service belongs. If the member is NULL or an empty string, the service does not belong to a load ordering group.

Dependencies

The short service name of services that are dependencies before this service can start.

ServiceStartName

The logon account for the service or LocalSystem.

DisplayName

The full display name for the service, for example: SQL Server (MSSQLSERVER).

Description

The full description for the service.

Sample

The following example code shows a task that uses the probe to generate data about the default SQL service:

<Task ID="Microsoft.Samples.GetSQLService" Accessibility="Internal" Target="Microsoft.Samples.ApplicationX">
  <Category>Operations</Category>
  <ProbeAction ID="ServiceProbe" TypeID="Windows!Microsoft.Windows.ExistingWin32ServiceInformationProbe">
    <ComputerName>$Target/Host/Property[Type='Windows!Microsoft.Windows.Computer']/NetworkName$</ComputerName>
    <ServiceName>MSSQLSERVER</ServiceName>
  </ProbeAction>
</Task>

The preceding example causes the probe to output data about the default instance of SQL Server. Data is output only if the service does not exist.

Information

   

Module Type

ProbeActionModuleType

Input Type

None

Output Type

System.PropertyBagData

Implementation

Composite

Library

Microsoft.Windows.Library