我正在尝试通过 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