0 Replies Latest reply on Feb 23, 2011 3:39 PM by jprosser

    Problem Running a vbscript as a trap action

      Hi Folks,

      Is there something special I need to do to run a vbscript ?

      I want to run the script this way using cscript:

      C:\tmp\customprop_update.vbs  ${NodeID}   ${vbData3}_${vbData4}  ${vbData5}  ${Time}

      When I run this from the command line it works fine, but no dice when a trap comes in.

      What happens to the Wscript.Echo output ?  Is there a log somewhere that gets updated?

      I want to update a custom property so I can reference it in an email action afterward.




      Here's the script:


      Dim objFSO, objFSOText, objFile
      Dim CLIARG
      Dim objArgs, strArg
      Dim nodeID,alarmID,alarmData,alarmTS
      Dim objConnection,objRecordSet
      Dim SQL

      strDirectory = "C:\tmp"

      'WScript.Echo " in the program"

      Set objArgs = WScript.Arguments

      nodeID    = WScript.Arguments(0)
      alarmID   = WScript.Arguments(1)
      alarmData = WScript.Arguments(2)
      alarmTS   = WScript.Arguments(3)

      CLIARG = "Args: " & nodeID &" "& alarmID  &" "& alarmData  &" "& alarmTS

      'Wscript.Echo "Just got"  & CLIARG

      'Connect to SQL and store the results in the table

      Set objConnection = CreateObject("ADODB.Connection")
      Set objRecordSet = CreateObject("ADODB.Recordset")

      'Wscript.Echo "Just opened db "

      objConnection.Open     "secret stuff"

      SQL = "update nodes set my_trap_data = '"& CLIARG & "' where nodeid=" & nodeID

      objConnection.execute SQL