WriteAction to generate Event

IBM.Windows.GenerateEvent (WriteActionModuleType)

WriteAction for generating in-band BladeCenter event

Element properties:

TypeWriteActionModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
InputTypeSystem.BaseData
OutputTypeSystem.CommandOutput

Member Modules:

ID Module Type TypeId RunAs 
WA WriteAction Microsoft.Windows.ScriptWriteAction Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
EventIDstring$Config/EventID$WriteAction Event IDWriteAction Event ID
Messagestring$Config/Message$WriteAction Event MessageWriteAction Event Message
EventTypestring$Config/EventType$WriteAction Event TypeWriteAction Event Type

Source Code:

<WriteActionModuleType ID="IBM.Windows.GenerateEvent" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element name="EventID" type="xsd:string"/>
<xsd:element name="Message" type="xsd:string"/>
<xsd:element name="EventType" type="xsd:string"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="EventID" Selector="$Config/EventID$" ParameterType="string"/>
<OverrideableParameter ID="Message" Selector="$Config/Message$" ParameterType="string"/>
<OverrideableParameter ID="EventType" Selector="$Config/EventType$" ParameterType="string"/>
</OverrideableParameters>
<ModuleImplementation>
<Composite>
<MemberModules>
<WriteAction ID="WA" TypeID="Windows!Microsoft.Windows.ScriptWriteAction">
<ScriptName>CreateEvents.vbs</ScriptName>
<Arguments>"$Config/EventID$" "$Config/Message$" "$Config/EventType$"</Arguments>
<ScriptBody><Script>

SetLocale("en-us")

Dim EventID, Message, EventType, EventSource
Dim oReg, RC_Code, debug
Const INFO_LEVEL = 4
Const HKEY_LOCAL_MACHINE = &amp;H80000002
Const DEBUG_INFO_KEY = "SOFTWARE\Lenovo\Lenovo SCOM MP\Debug"
Const DEBUG_LEVEL_NAME = "Level"

debug = -1
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oReg = GetObject("winmgmts://localhost/root/default:StdRegProv")
If (not(oReg is nothing)) Then
RC_Code = oReg.GetStringValue(HKEY_LOCAL_MACHINE, DEBUG_INFO_KEY, DEBUG_LEVEL_NAME, debug)
End If

If (WScript.Arguments.Count &lt; 3) Then
WScript.Quit -1
End If
EventID = WScript.Arguments.Item(0)
Message = WScript.Arguments.Item(1)
EventType = WScript.Arguments.Item(2)

Call LogDebugString("EventType: " + EventType + " EventID: " + EventID + " Source: ""BladeCenter OOB Events"" Message: " + Message, INFO_LEVEL)

Set WshShell = WScript.CreateObject("WScript.Shell")
strCommand = "eventcreate.exe /T """&amp; EventType &amp;""" /ID """&amp; EventID &amp;""" /L APPLICATION /SO ""BladeCenter OOB Events"" /D """ &amp; Message &amp; """"
WshShell.exec strcommand

Sub LogDebugString(debugString, debugLevel)
If (Int(debug) &gt;= Int(debugLevel)) Then
Call oAPI.LogScriptEvent("CreateEvents.vbs", 301, debugLevel, debugString)
End If

End Sub
</Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="WA"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.CommandOutput</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>