miteshlad2
Technical User
Hello all,
I've put together the following script which should fire the following snmp trap through a DOS Window when a certain process is detected, in this case i have used notepad.exe:
awtrap -f swccasn2 -h 10.101.44.31 -p 162 -c public 1 6 12 1 -s "hello this is a test trap"
however as the trap is rather big i have broken it down into many contants (hope there is an easier way to do this)
Question I have is how do I put the constants together again???
Here's what i've done so far...
Thanks
Mitesh
-----------------
Const TRAP1 = "awtrap"
Const TRAP2 = "-f"
Const TRAP3 = "LONW00054218"
Const TRAP4 = "-h"
Const TRAP5 = "10.101.44.37"
Const TRAP6 = "-p"
Const TRAP7 = "162"
Const TRAP8 = "-c"
Const TRAP9 = "public"
Const TRAP10 = "1"
Const TRAP11 = "6"
Const TRAP12 = "12"
Const TRAP13 = "1"
Const TRAP14 = "-s"
Const TRAP15 = "cars importer process has started"
strComputer = "LONW00054218"
Set objSWbemServices = GetObject("winmgmts:" &_
"{impersonationLevel=impersonate}!" &_
"\\" & strComputer & "\root\cimv2")
Set objEventSource = objSWbemServices.ExecNotificationQuery( _
"SELECT * FROM __InstanceCreationEvent " &_
"WITHIN 10 " &_
"WHERE TargetInstance " &_
"ISA 'Win32_Process' " &_
"AND TargetInstance.Name = 'notepad.exe'")
Set objEventObject = objEventSource.NextEvent()
Wscript.Echo "An instance of notepad.exe just started.
I've put together the following script which should fire the following snmp trap through a DOS Window when a certain process is detected, in this case i have used notepad.exe:
awtrap -f swccasn2 -h 10.101.44.31 -p 162 -c public 1 6 12 1 -s "hello this is a test trap"
however as the trap is rather big i have broken it down into many contants (hope there is an easier way to do this)
Question I have is how do I put the constants together again???
Here's what i've done so far...
Thanks
Mitesh
-----------------
Const TRAP1 = "awtrap"
Const TRAP2 = "-f"
Const TRAP3 = "LONW00054218"
Const TRAP4 = "-h"
Const TRAP5 = "10.101.44.37"
Const TRAP6 = "-p"
Const TRAP7 = "162"
Const TRAP8 = "-c"
Const TRAP9 = "public"
Const TRAP10 = "1"
Const TRAP11 = "6"
Const TRAP12 = "12"
Const TRAP13 = "1"
Const TRAP14 = "-s"
Const TRAP15 = "cars importer process has started"
strComputer = "LONW00054218"
Set objSWbemServices = GetObject("winmgmts:" &_
"{impersonationLevel=impersonate}!" &_
"\\" & strComputer & "\root\cimv2")
Set objEventSource = objSWbemServices.ExecNotificationQuery( _
"SELECT * FROM __InstanceCreationEvent " &_
"WITHIN 10 " &_
"WHERE TargetInstance " &_
"ISA 'Win32_Process' " &_
"AND TargetInstance.Name = 'notepad.exe'")
Set objEventObject = objEventSource.NextEvent()
Wscript.Echo "An instance of notepad.exe just started.