2014-10-22 138 views
0

我試圖通過VBScript訪問SNMP訪問一些OID值,因爲它是一個氣候監測器,它具有溫度,溼度和氣流的數字。我知道我需要使用哪些OID,但無法找到任何有效連接並提取此信息的腳本或代碼段。VBScript獲取SNMP 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 

回答

0
Set objSnmpManager = CreateObject("AxNetwork.SnmpManager") 
Set objConstants = CreateObject("AxNetwork.NwConstants") 

「許可證密鑰需要在試用期到期後,以解開這個組件。 '使用有效的許可證密鑰作爲第一個參數調用'激活'。第二個參數決定是否永久保存許可證密鑰 '到註冊表(True,因此您只需要調用Activate一次),或者永久保存密鑰(False,因此您需要每次調用Activate '被建造)。有關詳細信息,請參見手冊的「產品激活」一章。 ' 'objSnmpManager.Activate「XXXXX-XXXXX-XXXXX」,False