You must be a MyPeek member to download our extensibility solutions. Click here to learn more about the benefits of membership and find out how to sign up for free.
You must have a valid maintenance contract to download this file.
If you are not a LiveAction Maintenance Customer but would like to purchase a Maintenance contract for your LiveAction product please click here for sales information.
Category : Scripts
Submitted By : Savvius
Downloaded : 319 Times
Rating : Not Yet Rated
View Comments (0)
The following example script begins to demonstrate the flexibility and capability of the OmniScript API.
For more information about the OmniScript API check out the Omniscript API Reference
'---------------------------------------------------
' Start a remote capture at Adapter 1
'---------------------------------------------------
option explicit
Dim EPRCmdMgr
Dim RemoteAdapterList
Dim errVal
Dim nAdapterCount
Dim i, j, count, adapterName, captureGUID
Dim captureList, captureInfo
Dim EngineIP, EnginePort
On Error Resume Next
'---------------------------------------------------
' Create the Remote Command Manager
'---------------------------------------------------
set EPRCmdMgr = CreateObject("EPRCmdAPI.WPRemoteCmdMgr")
'---------------------------------------------------
' Connect to Remote Agent
'---------------------------------------------------
EngineIP="127.0.0.1"
EnginePort=6367
WScript.Echo "Connecting to Remote Agent at " & EngineIP & ":" & EnginePort
errVal = EPRCmdMgr.Connect(EngineIP, EnginePort, 30000 )
if Err.number <> 0 then
WScript.Echo Err.Description
WScript.Quit
end if
if errVal <> 0 Then
WScript.Echo "Connect Failed" & vbNewLine
WScript.Echo "Press Enter to finish..."
WScript.StdIn.ReadLine()
WScript.Quit
end if
'---------------------------------------------------
' Get the list of adapters
'---------------------------------------------------
Set RemoteAdapterList = EPRCmdMgr.GetRemoteAdapterList
adapterName = RemoteAdapterList.Item(0).Description
WScript.Echo "Selecting [" & adapterName & "]"
'---------------------------------------------------
' Create a capture
'---------------------------------------------------
WScript.Echo "Creating new capture"
captureGUID = EPRCmdMgr.CreateNewCapture( "AutoCapture-01",_
False,_
False, 0,_
False, 0,_
False, 0,_
False, 0,_
32000, adapterName )
WScript.Echo "Capture Created GUID: " & captureGUID
if err.number <> 0 Then
WScript.Echo "Failed to create new capture" & vbNewLine &_
"Error Code: " & err.Description
WScript.Quit
End IF
'---------------------------------------------------
' Start Capture
'---------------------------------------------------
EPRCmdMgr.StartCapture(captureGUID)
'---------------------------------------------------
' List Captures
'---------------------------------------------------
Call ListCaptures
WScript.Quit
'==============================================================================
' Functions
'==============================================================================
'------------------------------------------------------------------------------
' ListCaptures
'------------------------------------------------------------------------------
Function ListCaptures
Set captureList = EPRCmdMgr.GetCaptureList
if captureList is Nothing Then
WScript.Echo "Failed to get Capture List"
Exit Function
End IF
'If err.number <> 0 Then
' WScript.Echo "GetCapture List returned: " & err.number
' Exit Function
'End IF
count = captureList.Count
For j = 1 To count
Set captureInfo = captureList.Item(j-1)
WScript.Echo "[" & j & "] " &_
captureInfo.ID & " " &_
captureInfo.Name & " " &_
captureInfo.Status & " " &_
captureInfo.PacketsFiltered & " (" &_
captureInfo.PacketsTotal & ") "
Next
End Function