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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

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,

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
The batch solution can either work with AutoIt, or (and that is how I do it) by using netcat ( 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,3800010800,62037703,00.htm
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Network Architecture

From novice to tech pro — start learning today.