VBScript SNMP Queries

In the course of my work as a server administrator, it has become desirable to know what kind of hardware was currently being used in some of our servers. Well, it has been pretty easy to pull this kind of information from WMI. Nearly all of the hardware specs can be pulled using these traditional methods. More recently, I ran into a problem retrieving hard drive specs because the array controller on some servers would mask physical hard drive properties from the OS. Instead showing the hard drive as “Compaq Array Controller Driver”.

Well that wasn’t particularly useful information to me. I knew that this information was available to the SIM agents and that it could be viewed using Insight Manager console. After some poking around, figuring out how these things worked, I found out that all of this information could be found via SNMP queries. You can browse all of the available information with a few different free utilities.

I even found a command line utility called SNMPGET.exe that you can use to query specific OIDs providing you had the correct community string (thanks again SourceForge) Well since we can use this command line tool to extract information remotely from any server running SIM we could use this tool and a little VBScript to extract any data stored in an OID on any server we want.

First, though, we need a function that will simplify the process of extracting the value we are interested in:

This particular function is pretty simple. Provide the server you’re interested in, the community string to access this information, and the OID you’re interested in getting the information from and the function returns the value of the OID. You’ll have to alter the script so that it knows where to look for your SNMPGET.exe, but that should be the only modification you’ll need to get this function working in scripts of your own.

In my next post, I’ll elaborate on this information, showing you how to use this function in a sample VBScript file.

1 thought on “VBScript SNMP Queries

Leave a Comment