Solved

VB Programs for telneting into CISCO switch.

Posted on 2004-09-20
6
886 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:Albert1809
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Assisted Solution

by:mladenovicz
mladenovicz earned 250 total points
ID: 12102683
0
 
LVL 76

Expert Comment

by:David Lee
ID: 12102995
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
Next
If bolfound Then
    objShell.Exec "Telnet " & arrSwitches(intMatch)
Else
    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.
0
 
LVL 1

Author Comment

by:Albert1809
ID: 12105488
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Accepted Solution

by:
David Lee earned 250 total points
ID: 12105945
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.  
0
 
LVL 1

Author Comment

by:Albert1809
ID: 12106187
Half of the stuff on the script I don't remember. Can you point me to some breif tutorials?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 12108394
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question