VB Programs for telneting into CISCO switch.

At work we use dozens of cisco switches through out the building. We have to telnet into the them to make any changes. I have an idea to write a VB program that will allow me to just type in the floor and the location (east or west) and it will automatically run the command telnet switch_name. The naming  scheme for the switches are c6k5east, were 5 is the floor and east is the location.

I have taken VB in college, but it has been 1 1/2 years since i last used it. Can some one tell me in steps what I have to read, in steps, in order to complete my idea?

Any suggestions will help as well.
Who is Participating?
David LeeCommented:
I understand.  If you want a full-blown Telnet client written in VB, then the first link mladenovicz posted is probably your best bet.  You could modify it to add a dropdown list of switch names.  If instead you want a Telnet launcher, but one written in pure VB, then you can take some concepts from the sample I posted.  For example parallel lists, one to display the name of the switch for the user's viewing and another to hold the actual switch name;  using the WshShell to shell out and run the Telnet app once a switch is selected.  Another nice touch would be to read the switch names in from a file so that changes in switch names or locations don't force you to redo your application.  
David LeeCommented:
I don't know that you really need a Telnet app or even a VB program.  You can do this easily enough with a simple VBScript routine like this:

----- Script Tnet2Switch.Vbs
Dim objShell, arrNames, arrSwitches, intMatch, bolFound
Set objShell = CreateObject("Wscript.Shell")
strRequested = Wscript.Arguments.Item(0)
arrNames = Array("1east", "2east", "3east", "1west", "2west", "3west")
arrSwitches = Array("c6k1east", "c6k2east", "c6k3east", "c6k1west", "c6k2west","c6k3west")
For intMatch = 0 To UBound(arrNames)
    If strRequested = arrNames(intMatch) Then
        bolFound = True
        Exit For
    End If
If bolfound Then
    objShell.Exec "Telnet " & arrSwitches(intMatch)
    Wscript.Echo "Could not find a switch with the name (" & strRequested & ")."
End If
Set objShell = Nothing

----- End Script

All you need to do is edit the two arrays and put in the aliases for the switches in arrNames and the actual switch names in arrSwitches.  Then call the script like this:

    Tnet2Switch AliasName

The script will look for a matching switch and if it finds one it'll launch Telnet connecting to that switch.
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Albert1809Author Commented:
Thanks for the code. But I wanted to refresh my memory on VB and also would like to created a simple exe that would just ask me which router I want and just run it in telnet. Makes it easier for me and my staff to just have a program with a drop down list of all our switchs running. It's easier then starting the command prompt, and typing in "telnet switchname". But I'm mainly doing this to refresh my memery and get me more firmilur will VB. Once again, thankx for the code.
Albert1809Author Commented:
Half of the stuff on the script I don't remember. Can you point me to some breif tutorials?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.