Kód: Vybrat vše
'Microsoft SNMP GET script
'http://www.microsoft.com/technet/treeview/default.asp?url=/technet/ScriptCenter/network/scrnet07.asp
'Modified to use community string as a variable declared at the start of the program - all other code remains the same
strTargetSnmpDevice = "127.0.0.1"
strTargetSnmpCommunity = "public"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("","root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "AgentAddress", strTargetSnmpDevice
objWmiNamedValueSet.Add "AgentReadCommunityName", strTargetSnmpCommunity
Set colSystem = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_system",, _
objWmiNamedValueSet)
For Each objSystem In colSystem
WScript.Echo "sysContact: " & objSystem.sysContact & vbCrLf & _
"sysDescr: " & objSystem.sysDescr & vbCrLf & _
"sysLocation: " & objSystem.sysLocation & vbCrLf & _
"sysName: " & objSystem.sysName & vbCrLf & _
"sysObjectID: " & objSystem.sysObjectID & vbCrLf & _
"sysServices: " & objSystem.sysServices & vbCrLf & _
"sysUpTime: " & objSystem.sysUpTime
Next

