【问题标题】:VBScript get SNMP OID valuesVBScript 获取 SNMP OID 值
【发布时间】: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”?错误消息告诉您该组件实际上不存在。

标签: vbscript snmp oid


【解决方案1】:
Set objSnmpManager  = CreateObject( "AxNetwork.SnmpManager" )
Set objConstants    = CreateObject( "AxNetwork.NwConstants" )

' 在试用期到期后,需要许可证密钥才能解锁此组件。 ' 使用有效的许可证密钥作为其第一个参数调用 'Activate'。第二个参数决定是否永久保存许可证密钥 ' 到注册表(True,所以你只需要调用一次 Activate),或者不永久存储密钥(False,所以你需要调用 Activate ' 每次创建组件时)。有关详细信息,请参见手册中的“产品激活”一章。 ' ' objSnmpManager.Activate "XXXXX-XXXXX-XXXXX", False

【讨论】:

  • 您为什么认为 OP 使用的是 ActiveXperts 组件?如果不是,您的回复将毫无用处,也不会增加任何内容。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-09-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多