WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: seckner on May 14, 2014, 01:24:04 PM

Title: Query a network switch
Post by: seckner on May 14, 2014, 01:24:04 PM
Wondering how this was done and can WB do it... We loaded Spiceworks on the network today just to see what it was about. As it was inventorying the equipment on the network, somehow it's able to pull not only the network switch it's connected to but the physical port that it's connected to! Does anyone have any idea how they accomplished this? Is it possible to query a switch? We have HP switches but it's really not that far from a Cisco switch. Just really curious!
Title: Re: Query a network switch
Post by: Deana on May 14, 2014, 01:36:53 PM
Googled it and found this: http://community.spiceworks.com/help/How_Does_The_Scan_Work#Basic

It appears SNMP might be required..no real built-in support for SNMP in WinBatch:
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Networks~-~Servers+SNMP~in~WinBatch.txt

Might be able to handle using WinSock?
Title: Re: Query a network switch
Post by: seckner on May 14, 2014, 05:00:29 PM
Using the info you provided I went on a search - found 2 utilities called snmpget.exe and snmpwalk.exe that allow command line access to the snmp values that can be read - going to play with it tomorrow but it looks promising! Thank you Deana!
Title: Re: Query a network switch
Post by: ....IFICantBYTE on May 14, 2014, 08:10:47 PM
I have been using SNMP stuff in WinBatch for years (basic SNMP v1 get/walk only though) and have made a few utilities we use in the company I work for to monitor and report on our printer fleet and other devices.
I am using the little known built-in com component that Windows uses to interrogate printers (their bi-directional detection of printer capabilities), so it is native to all flavors of Windows.
It is able to be used to look at any SNMP device that has a known community name you can read settings from (so long as you don't need v3 authentication or want to wait for traps, support MIBs etc).

I have not tried any 3rd party .NET distributions that support SNMP yet. Most are not free, but I did find an open source one once that looked good... don't remember what it was but I saved it somewhere in case I wanted to try it one day.

Anyway, I will see if I have the time in the next day or so to pull out some of my SNMP code (can't give you the full source of the utilities I made due to privacy/copyright) and put it in an example script so that you can make use of it if you like.
Title: Re: Query a network switch
Post by: ....IFICantBYTE on May 17, 2014, 01:57:46 AM
Seckner,
I have just posted some example SNMP V1 stuff in the Script Exchange area for you.