Hopefully "ScriptingTipsAndTricks" helps you with your batch file or vbscript scripting :-)
[Bottom][Contents][Prev]: ScriptoMatic[Next]: NirSoft's Tools
\->Useful Programs->Microsoft Tools->SNMPUTIL.exe (command line SNMP tool)

SNMPUTIL.exe (command line SNMP tool)

Some links:

This utility allows you to get information from devices, the program takes a while to respond so I recommend pinging the device first and only performing the command if it responds to the pings.

Also have a look at the Net-SNMP collection of Open Source mostly command line SNMP Tools (including SnmpSet.exe).

Many devices including Lexmark Printers will return meaningful information with this command:

snmputil.exe get 15.132.121.23 public system.sysDescr.0

The following is the output from a Lexmark printer:

Variable = system.sysDescr.0
Value    = String Lexmark T522 version 54.30.06 kernel 2.3.0-test5 All-N-1

Other OIDs which work for Lemark printers:

The "walk" command can be used to dump an OID and all child levels:

snmputil.exe walk 15.132.121.23 public .1.3

I used the printer menu to determine the current value of the item I was interested in finding and searched the "walk" command's output to determine the correct "oid" names. The liinks above and a quick Google may also help :-)

I found this batch file handy when looking for printer OIDs:

@echo off
@setlocal
cls
if     "%~1" == "" @set Printer=177.136.128.18
if not "%~1" == "" @set Printer=%~1
set   OutDir=$WALK$\%Printer%
set Combined=%OutDir%\COMBINED-%Printer%.txt
md "%OutDir%" >nul 2>&1
del "%Combined%" > nul 2>&1

call :WalkOid   1
call :WalkOid   2
call :WalkOid   3
call :WalkOid   4
call :WalkOid   5
call :WalkOid   6
call :WalkOid   7
call :WalkOid   .1.3

start notepad.exe "%Combined%"
goto :EOF


::++++++++++++++++++++++++
:WalkOid
::++++++++++++++++++++++++
   set     Oid=%~1
   set OidFile=%OutDir%\Walk.[%Printer%].{%Oid%}.txt
   set     CMD=snmputil.exe walk %Printer% public %Oid%
   echo %CMD%
   %CMD% > "%OidFile%"
   echo REPORT FOR OID: %OID%           >> "%Combined%"
   echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> "%Combined%"
   type "%OidFile%" >> "%Combined%"
   echo. >> "%Combined%"
   echo. >> "%Combined%"
   echo. >> "%Combined%"
   goto :EOF

I know of no way to query a random device to work out what root OIDs exist. Please let me know if you do :-)

SYNTAX: SnmpUtil.exe

Error:  Incorrect number of arguments specified.

usage:  snmputil [get|getnext|walk] agent community oid [oid ...]
        snmputil trap


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: ScriptoMatic[Next]: NirSoft's Tools


ScriptingTipsAndTricks© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday September 07 2014 at 12:50pm
Visit ScriptingTipsAndTricks's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.