SetLocale("en-us")
HandleErrorContinue("Cannot set en-us locale")
Dim oAPI
Dim message : message = "Enterprise agent is being installed." & vbcrlf _
& "To check refer to Enterprise .NET Monitoring Agent instance under " & vbcrlf _
& """AVIcode .NET Application Monitoring\Monitoring Agent State"" view."
WScript.StdOut.WriteLine message
Set oAPI = CreateObject("MOM.ScriptAPI")
If WScript.Arguments(0) = "true" Then
Call oAPI.LogScriptEvent("AVIcode .NET Enterprise Management Pack for OpsMgr 2007", 19999, 0, message)
Else
Call oAPI.LogScriptEvent("AVIcode .NET Enterprise Management Pack for OpsMgr 2007", 19998, 0, message)
End If
Sub HandleError(customMessage)
If Not (Err.number = 0) Then
LogError customMessage
Wscript.Quit 0
End If
End Sub
Function HandleErrorContinue(customMessage)
HandleErrorContinue = False
If Not (Err.number = 0) Then
LogError customMessage
Err.Clear
HandleErrorContinue = True
End If
End Function
Sub LogError(customMessage)
Dim msg
If Not (Err.number = 0) Then
msg = Replace(" Error: #P1# Description: #P2# ", "#P1#", CStr(Err.number) )
msg = Replace(msg, "#P2#", Err.Description )
msg = customMessage & VbCrLf & msg & VbCrLf
If UCase(Hex(Err.number)) = UCase("80041006") Then
msg = msg & "WMI Error. Not enough memory for the operation." & VbCrLf
End If
WScript.StdOut.WriteLine msg
msg = msg & " [" & ScriptInfo() & "]"
LogEvent msg, 1
End If
End Sub
Function ScriptInfo()
Dim commandLineInfo : commandLineInfo = WScript.ScriptFullName
Dim argument
For Each argument In WScript.Arguments
commandLineInfo = commandLineInfo & " """ & argument & """"
Next
ScriptInfo = commandLineInfo
End Function
Sub LogEvent (message, eventType)
Dim errorEventId : errorEventId = 20000
Dim oAPI0 : Set oAPI0 = CreateObject("MOM.ScriptAPI")
Call oAPI0.LogScriptEvent("AVIcode .NET Enterprise Management Pack for OpsMgr 2007", errorEventId, eventType, message)
End Sub </Script></ScriptBody>
<TimeoutSeconds>300</TimeoutSeconds>
</WriteAction>
</MemberModules>
<Composition>
<Node ID="InitiateInstallEnterpriseModeWA"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.BaseData</OutputType>
<InputType>System!System.BaseData</InputType>
</WriteActionModuleType>