【发布时间】:2014-10-22 12:19:43
【问题描述】:
我正在尝试使用通过 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
【问题讨论】:
-
您在哪里找到“Scripting.SNMPManager”?错误消息告诉您该组件实际上不存在。