Microsoft.Windows.ScriptDiscoveryProbe
Applies To: Operations Manager 2007 R2
The Microsoft.Windows.ScriptDiscoveryProbe probe action module type is used to run a script as part of a discovery workflow. The module type accepts System.BaseData data and outputs System.Discovery.Data data.
Usage
Use this module when you want to gather data from a script on a monitored computer to return class type instance discovery data. Because this module is a probe action type and discovery workflows contain only one data source module that outputs discovery data, you must contain any implementation of this module from within a custom data source module type. This module generally needs to be used only for discovery scripts that are triggered by data sources other than the simple scheduler. If you need a data source module type that implements a simple scheduler, use the Microsoft.Windows.TimedScript.DiscoveryProvider module instead.
Type Definition
<ProbeActionModuleType ID="Microsoft.Windows.ScriptDiscoveryProbe" Accessibility="Public" PassThrough="false" Batching="false">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.CommandExecuterSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="ScriptName" type="xsd:string" />
<xsd:element name="Arguments" type="xsd:string" />
<xsd:element name="ScriptBody" type="xsd:string" />
<xsd:element name="SecureInput" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TimeoutSeconds" type="xsd:integer" />
<xsd:element minOccurs="0" maxOccurs="1" name="EventPolicy" type="CommandExecuterEventPolicyType" />
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="Arguments" Selector="$Config/Arguments$" ParameterType="string" />
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<ProbeAction TypeID="Microsoft.Windows.ScriptProbeDiscoveryBase" ID="Script">
<ApplicationName><![CDATA[%windir%\system32\cscript.exe]]></ApplicationName>
<WorkingDirectory />
<CommandLine>/nologo "$Config/ScriptName$" $Config/Arguments$</CommandLine>
<SecureInput>$Config/SecureInput$</SecureInput>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<RequireOutput>true</RequireOutput>
<Files>
<File>
<Name>$Config/ScriptName$</Name>
<Contents>$Config/ScriptBody$</Contents>
<Unicode>true</Unicode>
</File>
</Files>
<OutputType>System.Discovery.Data</OutputType>
<DefaultEventPolicy>
<StdOutMatches Operator="DoesNotMatchRegularExpression"><![CDATA[<DataItem.+/DataItem\b*>}|{<DataItem.*/>}]]></StdOutMatches>
<StdErrMatches>\a+</StdErrMatches>
<ExitCodeMatches>[^0]+</ExitCodeMatches>
</DefaultEventPolicy>
<EventPolicy>$Config/EventPolicy$</EventPolicy>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Script" />
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
<InputType>System!System.BaseData</InputType>
</ProbeActionModuleType>
Parameters
The Microsoft.Windows.ScriptDiscoveryProbe module supports the configuration parameters described in the following table.
Parameter | Type | Overrideable | Description |
---|---|---|---|
ScriptName |
String |
False |
Required parameter. Contains the file name of the script (including the extension) that identifies the script type. |
Arguments |
String |
True |
Required parameter. Contains the arguments to be supplied to the script on execution. |
ScriptBody |
String |
False |
Required parameter. Contains the script contents. If the script contains XML characters that must be escaped, it is recommended that the entire script be wrapped in a CDATAelement. |
SecureInput |
String |
False |
Optional parameter. Contains the data to be passed to the script in a secure method. This is used to provide passwords to the script to be used during execution. Maximum length of the string is 256 characters. |
TimeoutSeconds |
Integer |
True |
Required parameter. Specifies the time the script is allowed to run before being closed by the module and marked as failed. |
EventPolicy |
False |
Optional parameter. Defines the expected output and the behavior based on unexpected output from the script |
For more information about all parameters of this module, see Microsoft.Windows.ScriptProbeAction.
Composition
The Microsoft.Windows.ScriptDiscoveryProbe module is a composite module that contains the member module described in the following table.
Workflow Run Order | Module Type | Usage |
---|---|---|
1 |
Microsoft.Windows.ScriptProbeDiscoveryBase |
Internal module. |
Related Modules
Module Type |
Usage |
Used for discovery scripts that are triggered by data sources other than the simple scheduler. |
|
Used for monitoring scripts that are triggered by data sources other than the simple scheduler. |
|
Used as a task or recovery when the script is changing something on the system on which it is run. |
|
Used for scheduled scripts that output data that is mapped to an event and stored in the Operations Manager databases. |
|
Used for scheduled scripts that are used in rule or monitor workflows. This module type provides property bag output that is better suited for XPath referencing and expression evaluation. This module is triggered by the simple scheduler. |
External Module References
The Microsoft.Windows.ScriptDiscoveryProbe module is a member of the module described in the following table.
Module Type | Library | Usage |
---|---|---|
Microsoft.Windows.Library |
Used for scheduled discovery scripts that are triggered by the simple scheduler. |
Remarks
For remarks, see Microsoft.Windows.ScriptProbeAction.
Sample
The following XML sample shows an example of a discovery that uses the Microsoft.Windows.ScriptDiscoveryProbe module to discover a class instance at the specified interval.
The following section of this sample shows how the Microsoft.Windows.TimedScript.DiscoveryProvider discovery module defines Microsoft.Windows.ScriptDiscoveryProbe as a member module.
<DataSourceModuleType ID="Microsoft.Windows.TimedScript.DiscoveryProvider" Accessibility="Public">
<Configuration>
<IncludeSchemaTypes>
<SchemaType>System!System.ExpressionEvaluatorSchema</SchemaType>
<SchemaType>System!System.CommandExecuterSchema</SchemaType>
</IncludeSchemaTypes>
<xsd:element name="IntervalSeconds" type="xsd:int" />
<xsd:element name="SyncTime" type="xsd:string" />
<xsd:element name="ScriptName" type="xsd:string" />
<xsd:element name="Arguments" type="xsd:string" />
<xsd:element name="ScriptBody" type="xsd:string" />
<xsd:element name="SecureInput" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="256" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TimeoutSeconds" type="xsd:integer" />
<xsd:element minOccurs="0" maxOccurs="1" name="EventPolicy" type="CommandExecuterEventPolicyType" />
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int" />
<OverrideableParameter ID="SyncTime" Selector="$Config/SyncTime$" ParameterType="string" />
<OverrideableParameter ID="Arguments" Selector="$Config/Arguments$" ParameterType="string" />
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int" />
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<DataSource TypeID="System!System.Discovery.Scheduler" ID="DS1">
<Scheduler>
<SimpleReccuringSchedule>
<Interval>$Config/IntervalSeconds$</Interval>
<SyncTime>$Config/SyncTime$</SyncTime>
</SimpleReccuringSchedule>
<ExcludeDates />
</Scheduler>
</DataSource>
<ProbeAction TypeID="Microsoft.Windows.ScriptDiscoveryProbe" ID="Script">
<ScriptName>$Config/ScriptName$</ScriptName>
<Arguments>$Config/Arguments$</Arguments>
<ScriptBody>$Config/ScriptBody$</ScriptBody>
<SecureInput>$Config/SecureInput$</SecureInput>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<EventPolicy>$Config/EventPolicy$</EventPolicy>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="Script">
<Node ID="DS1" />
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>
The next section of this sample shows how the preceding data source module type is implemented within a discovery workflow. The class type definition is included for clarity.
<ClassType ID="Microsoft.Samples.ScriptDiscovery.TheApplication " Abstract="false" Accessibility="Internal" Hosted="true" Base="Windows!Microsoft.Windows.LocalApplication">
<Property ID="Version" Type="string"/>
<Property ID="Path" Type="string"/>
</ClassType>
…
<Discovery ID="Microsoft.Samples.ScriptDiscovery.TheApplication.Discovery" Target="Windows!Microsoft.Windows.Server.Computer" Remotable="false" Enabled="true">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="Microsoft.Samples.ScriptDiscovery.TheApplication">
<Property PropertyID="Version"/>
<Property PropertyID="Path"/>
<Property TypeID="System!System.Entity" PropertyID="DisplayName"/>
</DiscoveryClass>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.DiscoveryProvider">
<IntervalSeconds>3600</IntervalSeconds>
<SyncTime/>
<ScriptName>Microsoft.Samples.DiscoverApp.vbs</ScriptName>
<Arguments>$MPElement$ $Target/Id$ $Target/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Arguments>
<ScriptBody>
<![CDATA[
Option Explicit
Dim oArgs
Set oArgs = WScript.Arguments
if oArgs.Count < 3 Then
Wscript.Quit -1
End If
Dim SourceID, ManagedEntityId, TargetComputer
SourceId = oArgs(0)
ManagedEntityId = oArgs(1)
TargetComputer = oArgs(2)
Dim oFso
Set oFso = CreateObject("Scripting.FileSystemObject")
Dim oAPI, oDiscoveryData, oInst
Set oAPI = CreateObject("MOM.ScriptAPI")
set oDiscoveryData = oAPI.CreateDiscoveryData(0, SourceId, ManagedEntityId)
If (oFso.FolderExists("C:\Microsoft\Samples\Modules")) Then
set oInst = oDiscoveryData.CreateClassInstance("$MPElement[Name=' Microsoft.Samples.ScriptDiscovery.TheApplication]$")
call oInst.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", TargetComputer)
call oInst.AddProperty("$MPElement[Name=`Microsoft.Samples.ScriptDiscovery.TheApplication]/Version$", "2.0")
call oInst.AddProperty("$MPElement[Name=`Microsoft.Samples.ScriptDiscovery.TheApplication]/Path$", "C:\Microsoft\Samples\Modules")
call oInst.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", "TheApplication")
call oDiscoveryData.AddInstance(oInst)
End If
Call oAPI.Return(oDiscoveryData)
]]>
</ScriptBody>
<TimeoutSeconds>20</TimeoutSeconds>
</DataSource>
</Discovery>
Information
Module Type |
|
Input Type |
|
Output Type |
|
Implementation |
Composite |
Library |
Microsoft.Windows.Library |