How can I use VB.NET to automatically telnet into my switch and run a command and capture the output?
Posted on 2011-09-21
Ok, so what I need to do is have a program telnet into my switch and simply run the command "show arp" which echo's out two columns, IP ADDR and MAC ADDR. there are many ips and macs that will be shown from this command and normally when i just telnet in via command prompt in windows it will display the first 19 and i have to hit the enter key to display the next set of results until the last results are displayed and i'm back to a #: prompt.
what I'm needing is a way to "auto telnet" in sending the username/password and have the show arp command issued along with the enter key until it's done echoing out the list of mac / ip addresses, then save that output as a file or parse the mac/ip list so i can enter that data into a database.
is this possible to achieve in VB.NET? the best result for me would be that vb.net could telnet in and get the data then i could write code to connect to an sql db for entering the data.
I need for my program to either stay logged in and issue the commands every 30 seconds or so, or close the connection and telnet in again every 30 seconds to repeat the process.
anyone have any code that can be used to telnet in and issue commands i need then capture the output?
thanks for your help.