- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
running .vbs script as alert output action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Try using a .bat file to call the .vbs script.
enVision has no problems executing .bat as an alert output action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Are there any path dependencies that may come into play?
Perhaps within the .bat file, cd to the directory of interest,then execute the .vbs?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello
Anyway you can share the script coding with us?
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
This is the script it's a bit untidy but this would work. You need to create a .cmd or a .bat to call the script. and ensure that there is an additional output action to create the feed.txt file to hold the data from the alert. So there would be two output actions.
1. Create the feed.txt file with the detail from the alert
2. Call the batch file to run the script.
you can chop it about to extract specific fields.
Make sure to place the files in the C: partition otherwise it won't work. Let me know how you get on.
Option Explicit
On Error Resume Next
'wscript.echo "running"
Dim arrTxtArray(4)
Dim myfile
Dim objTextFile
Dim viewname
Dim eventdate
Dim hostname
Dim message
Dim title1
Dim intSize
Dim objFSO
Dim i
Dim oshell
Dim filesys
intSize = 0
myfile = "c:\cawto\feed.txt"
'wait to ensure that the feed file is created and complete
'wscript.sleep 30000
'open file for reading
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
(myFile, ForReading)
'read file and place each field into array
set oshell = WScript.CreateObject("WScript.Shell")
If objFSO.FileExists("c:\cawto\feed.txt") Then
Do Until objTextFile.AtEndofStream
objtextFile.skip(10)
viewname = objTextFile.ReadLine
objTextFile.skip(10)
eventdate = objTextFile.ReadLine
objTextFile.skip(12)
hostname = objTextFile.Read(8)
objTextFile.skipline
message = objTextFile.ReadLine
blank = objTextFile.Readline
arrTxtArray(1) = viewname
arrTxtArray(2) = eventdate
arrTxtArray(3) = hostname
arrTxtArray(4) = message
wscript.echo arrTxtArray(1)
wscript.echo arrTxtArray(2)
wscript.echo arrTxtArray(3)
wscript.echo arrTxtArray(4)
'run cawto command inserting fields from array into the command to send message to NSM
'oshell.run ("cawto -n xxx.xxx.xxx.xxx """&arrTxtArray(1)&" "&arrTxtArray(2)&" "&arrTxtArray(3)&" "&arrTxtArray(4)&"""")
Loop
End If
objTextFile.close
'delete feed file ready for next alert
'If objFSO.FileExists("c:\cawto\feed.txt") Then
'objFSO.DeleteFile "c:\cawto\feed.txt"
'End If
'wscript.echo "complete"
