I found the following example for use with windows scripting. I made some minor tweeks to get it to compile in vb.net. Question; is it considered bad form to be using 'CreateObject' in .net? Is there a more .net recommended way of doing the same thing?
Thanks,
Dan
Dim strTargetSnmpDe vice As String = "127.0.0.1"
Dim strTargetSnmpCo mmunity As String = "public"
Dim objWmiLocator As Object = CreateObject("W bemScripting.SW bemLocator")
Dim objWmiServices As Object = objWmiLocator.C onnectServer("" , "root\snmp\loca lhost")
Dim objWmiNamedValu eSet As Object = CreateObject("W bemScripting.SW bemNamedValueSe t")
objWmiNamedValu eSet.Add("Agent Address", strTargetSnmpDe vice)
objWmiNamedValu eSet.Add("Agent ReadCommunityNa me", strTargetSnmpCo mmunity)
Dim colSystem = objWmiServices. InstancesOf("SN MP_RFC1213_MIB_ system", , objWmiNamedValu eSet)
For Each objSystem As Object In colSystem
Console.WriteLi ne("sysContact : " & objSystem.sysCo ntact & vbCrLf & "sysDescr: " & objSystem.sysDe scr & vbCrLf & "sysLocatio n: " & objSystem.sysLo cation & vbCrLf & "sysName: " & objSystem.sysNa me & vbCrLf & "sysObjectI D: " & objSystem.sysOb jectID & vbCrLf & "sysService s: " & objSystem.sysSe rvices & vbCrLf & "sysUpTime: " & objSystem.sysUp Time)
Next
Console.Read()
"Dan" wrote:
Does anyone have any samples or references to get me started with WMI for collecting SNMP information? Any help is appreciated.
Thanks,
Dan