' [NOTE]
' On using VMMPro for event source: for a PRO tip recovery, the script is running on
' the physical VM host under a designated OpsMgr action account, which may not
' the privilege to create a new event source. Therefore we are stuck with the
' VMMPro for event source. Since the event id selected is arbitrary, there is
' a chance for collision; consequently we take extra precaution to avoid
' misfiring, with a prequalifier prepended in the description.
' Use "||" as separators.
sLogDesc = sVMHostName & " || " & sVMMServerName & " || " & sEventOriginalId
sLogDesc = "Lenovo Hardware PRO Tip Recovery || " & sLogDesc
sCmdLine = "eventcreate /T WARNING /ID 700 /L APPLICATION /SO VMMPro /D """ & sLogDesc & ""
Call LogDebugString( "Implementing PRO tip by... '" & sCmdLine & "'", INFO_LEVEL )
Dim oReg, rcCode, debugLevel
debugLevel = ERROR_LEVEL - 1
Set oReg = GetObject("winmgmts://localhost/root/default:StdRegProv")
If (Err = 0) Then
Dim sLevelValue
rcCode = oReg.GetStringValue(HKEY_LOCAL_MACHINE, HWPRO_KEYPATH + "\" + DEBUG_ROOT_KEYNAME, _
DEBUG_LEVEL_VALUENAME, sLevelValue)
If (IsNull(sLevelValue)) Then
rcCode = oReg.GetStringValue(HKEY_LOCAL_MACHINE, HWPRO_KEYPATH_Lenovo + "\" + DEBUG_ROOT_KEYNAME, _
DEBUG_LEVEL_VALUENAME, sLevelValue)
End If
If (Err = 0 And Not(IsNull(sLevelValue))) Then
On Error Resume Next
debugLevel = CInt(sLevelValue)
On Error Goto 0
End If
End If
InitLogDebugLevel = debugLevel
End Function
Sub LogDebugString(debugString, debugLevel)
If (Int(gDebugLevel) >= Int(debugLevel)) Then
Dim eventLogLevel
If debugLevel <= ERROR_LEVEL Then
eventLogLevel = ERROR_LEVEL
ElseIf debugLevel <= WARNING_LEVEL Then
eventLogLevel = WARNING_LEVEL
Else
eventLogLevel = INFO_LEVEL
End If
Call oAPI.LogScriptEvent(gScriptName, 700, eventLogLevel, debugString)
End If
End Sub </Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="CreateEventLogEntry"/>
</Composition>
</Composite>
</ModuleImplementation>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>