Microsoft.Windows.TimedScript.DiscoveryProvider
Applies To: Operations Manager 2007 R2
The Microsoft.Windows.TimedScript.DiscoveryProvider data source module type is used to run a script as part of a scheduled discovery workflow. This module type returns System.Discovery.Data data.
Usage
Use this module when you want to gather data from a scheduled script on a monitored computer to return class type instance discovery data.
Type Definition
<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>
Parameters
The Microsoft.Windows.TimedScript.DiscoveryProvider module supports the following configuration parameters:
Parameter | Type | Overrideable | Description |
---|---|---|---|
IntervalSeconds |
Integer |
True |
Required parameter. The recurring interval of time in seconds in which to run the script. |
SyncTime |
String |
True |
Required parameter. The synchronization time specified by using a 24-hour format. If you do not want to specify a synchronization time, you can include the element, but without any value (for example, <SyncTime/>). |
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 CDATA element. |
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 on the IntervalSeconds and SyncTime parameters of this module, see PublicSchedulerType.
For more information about the remaining parameters of this module, see Microsoft.Windows.ScriptProbeAction.
Composition
The Microsoft.Windows.TimedScript.DiscoveryProvider module is a composite module that contains the member modules described in the following table.
Workflow Run Order | Module Type | Usage |
---|---|---|
1 |
Triggers the subsequent discovery script to run at the specified scheduled interval and synchronization time. |
|
2 |
Runs the script and returns discovery data. |
Remarks
For more information about writing Operations Manager discovery and monitoring scripts, see Operations Manager 2007 R2 Scripting Objects.
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 is triggered by the simple scheduler. |
External Module References
None.
Sample
The following XML sample shows how a Microsoft.Windows.TimedScript.DiscoveryProvider discovery module implements the Microsoft.Windows.TimedScript.DiscoveryProvider as its data source. 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 |
None. |
Output Type |
|
Implementation |
Composite |
Library |
Microsoft.Windows.Library |