Solved

VB Programs for telneting into CISCO switch.

Posted on 2004-09-20
6
856 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use Multiple Forms 4 49
I Need help preventing my button click event from being raised twice on my VB.Net application 6 73
VBA filters 2 51
Problem to With line 4 43
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now