我试图通过VBScript使用访问SNMP来访问一些OID值,因为它是一个有温度,湿度和气流数据的气候监测器。我知道我需要使用哪些OID,但找不到任何有效连接和提取这些信息的脚本或代码。
有没有人能买到符合条件的东西?
我尝试使用此代码,但一直收到错误:ActiveX component can't create object: 'Scripting.SNMPManager'
Set oSNMPManager = CreateObject("Scripting.SNMPManager")
oSNMPManager.Agent = "unitip"
oSNMPManager.Community = "public"
'Add Variable objects to Variables collection
Call oSNMPManager.Variables.Add( "1.3.6.1.4.1.17373.2.2.1.6.1" )
Result = oSNMPManager.Get( ErrorIndex )
WScript.Echo "Get result: " & Result
If Result = 10 Then
WScript.Echo "ErrorIndex: " & ErrorIndex
End If
'Display properties of all Variable objects
WScript.Echo "OID, Type, Value"
For Each SNMPVariable in oSNMPManager.Variables
WScript.Echo SNMPVariable.OID & ", " & SNMPVariable.Type & ", " & SNMPVariable.Value
next
'Remove all Variable objects from the Variables collection
oSNMPManager.Variables.RemoveAll