cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
732
Views
2
Helpful
6
Replies

Creating a script to run on Putty

jwolfer
Community Member

Hi,

I'm looking into seeing if Putty will be able to run some scripts on an C2960x switch. We currently will putty into the unit and type out several commands to either upgrade the IOS or downgrade them. What I looking to achieve is somehow create a script that will run to complete this process, instead of typing out line or line items. 

Currently what I do is I copy and paste the commands into putty and go from there. Just looking for a way to automate this process so it will be easier if possible. I'm still learning about scripting so bear with me on this. Any help will be appreciated if this is possible. 

6 Replies 6

@jwolfer 

 There are many ways to achieve what you are looking for. Putty is a SSH client and used to type commands on the device. If you are planning to work with automated script, you are going to need to run the script from some OS. Usually Linux is the best for this purpose. 

 Use AI to build your script, if you are not experienced in coding, this will give you a starter. Just make to use it in a test environment first before going to production. 

 Practically everything can be automated on the cisco switch if you dedicate time to build the scripts accordingly

balaji.bandi
Hall of Fame
Hall of Fame

I have tried IOS XE with Python for Cat 9300

https://github.com/timo-juhani/lan_upgrade

but still below code helpfull for IOS code :

https://gist.github.com/kubsoo/39d9e72e035a131099a82bf3f577f985#file-upgrade_cisco-py

BB

=====️ Preenayamo Vasudevam ️=====

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Thanks, but I already have the command line items. I just need to figure out you to get the script to work.

Check the upgrade IOS, that script has all the information.

BB

=====️ Preenayamo Vasudevam ️=====

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

pieterh
VIP
VIP

putty does not have such an option!
the best that you can do is a single command : https://documentation.help/putty/using-cmdline-m.html
With some servers (particularly Unix systems), you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers. In particular, it is known not to work with certain ‘embedded’ servers, such as Cisco routers.

-> you need another terminal emulator (or tool)  that can read multiple commands from a file
    and preferably has the possibility to handle error-responses 

This isn't exactly what you were asking, but you can collapse the pasted commands to putty down to a single line if the commands are exactly the same. You could put them in a file on an HTTP(S) server and use:

copy http://[server]/mycommands.txt run