• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4036
  • Last Modified:

Creating a batch file to control a Cisco Catalyst 2950 Switch Ports

Hi experts,

I need to create a batch file / or any other method, that will enable a user in the Network Operation Center (who has no knowledge of Cisco IOS) to enable and disable certain ports on the Switch.
1 Solution
Its very simple. You can create simple text file with the commands like this
To disable the port-
interface GigabitEthernet0/1
To enable the port-
interface GigabitEthernet0/1
no shut
He just need to change the port number and copy paste these two lines after login on the switch. you can do multiple ports at time by adding same lines in single file or use interface range command.

Whey make things difficult ? Use the GUI - Cluster Management Suite - Standard on the 2950 switches.
Enable on de switch http:
ip http server

login by browser (no username only password =enable secret)

You will see the switch graphically !!!

Right clik on "port" and select --> port settings --> by status you can enable/disable a port

Click and Play!

No mistakes can happen !!!

oneygAuthor Commented:
Thanks for the prompt reply guys

Magim IT:
I want to put thos command in a batch file so that just one click can do that. The thing I face is that whenevere I ran that batch file, It does not accept the entries written in the batch file and requires a user login and password. I do not want user to touch Cisco IOS!

This is the Batch File:
' Telnet
password (telnet password)
config t
interface fastethernet0/5

the batch file to enable has no shutdown instead of a shutdown line.

Yours is a good idea too. It was my first approach when tackling this issue. But when I use http I get the login that requires username and password (priviledge 15). But when I disable the port it does not want to save changes.
When you said 'ip http server' is that a command I should run to enable the feature you are refering to?

Thanks again for the prompt replies guys.

KR., Onesmo
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Istvan KalmarHead of IT Security Division Commented:

I advise you to use privilege levels, cisco has (0 - 15) 15 is a superuser, you able to give policies to a privilege level!

Please refer this page:

If you want to enable it via radius see this:


Best Regards,

QlemoBatchelor and DeveloperCommented:
The batch solution can either work with AutoIt, or (and that is how I do it) by using netcat (http://joncraton.org/files/nc111nt.zip). With netcat, you can do stuff like

(echo user
 echo password
 echo do-whatever
) | nc -t cisco.domain.local 23 -i 1

Have a look at this link, maybe helpful to you
Here is the script
  set  WshShell = WScript.CreateObject("WScript.Shell")
  WshShell.Run "cmd"
  WScript.Sleep 100
  WshShell.AppActivate "C:\Windows\system32\cmd.exe"
  WScript.Sleep 300
  WshShell.SendKeys "telnet{ENTER}"
  WScript.Sleep 300
  WshShell.SendKeys "telnet password"
  WshShell.SendKeys "{ENTER}"
  WScript.Sleep 300
  WshShell.SendKeys "configure terminal"
  WshShell.SendKeys "{ENTER}"
  WScript.Sleep 300
  WshShell.SendKeys "interface fastethernet0/5"
  WshShell.SendKeys "{ENTER}"
  WScript.Sleep 300

Save the file as .vbs and double click to run............Have a fun
oneygAuthor Commented:
This is Exactly what I wanted. Thanks a lot Magim IT. Now I am trying to get it in a web application on one of my servers and save this script there! But for this task I am giving out all the points I will give extra points for the next solutions.

Thanks again for this.
Abdul RazzakCommented:
I want to know the script of logical ether-channel.
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now