Showing results for 
Search instead for 
Did you mean: 

Script to clear configurations on multiple Cisco Switches at a time using a console switch.

I have a ton of switches which needs to be cleared of the configs and we bought a console switch to automate the process, can anyone help me with a script or a way to reset multiple switches to default configuration. Please post the script and a way to do it, i will test it out and will post the results. In this way it will be useful to everyone. Thank you.

Zaaf Aba



I have done the bulk configuration edit via telnet or ssh from a Linux machine using expect script.

As you mentioned that you bought a console switch I am guessing what you mean is a "Cisco Access Server Terminal Server AS2500 series"

Please share the command input and output of erasing one switch for script to be generated.






I am planning to use a seramux 16 port switch, if there are any other ways to perform this task then let me know as it will be a big help.

Hi Vannapa


I am familiar with NM-16A with octal cable or AS2511. Did a quick search for seramux 16 port switch on google but nothing came up unfortunately.

Moreover as requested previously can you share a command output for clearing configuration for one switch using the switch you mentioned.


In summary you have three options

- Manually connect to one switch's console port at a time and clear the configuration manually.

- Use terminal device with multiple ports. Connect each port from terminal server to individual switch's console port. Login to terminal device and manually clear each switch's configuration one after another.

- User terminal device with multiple ports. Connect each port from terminal server to individual switch's console port. configuration a script on your PC which login to terminal device  and clear each switch's configuration one after another.


Unfortunately there is no generic script. I would need an example of how you login to terminal device (telnet easy to automate) and connect to switches.

A quick search came up with good examples and




Thank you Zaaf, for the suggestion i will check them out.

And I may have given the wrong name for the console switch, it is called as SERIMUX.

And there is a mode in the console switch, which will give allow a script to run cmd's on the devices connected to the interfaces of SERIMUX.

The documentation of the console switch explains the mode as follows.

User Terse mode
This mode is especially useful when the SERIMUX is directly controlled by external software from a serial console (as a user
without administrative privileges), rather than being controlled by a user from a keyboard interface.
Entering short command strings performs functions similar to the user main menu commands. A [CR] – [LF] sequence ends every
string. The commands are not echoed; the SERIMUX returns to the serial console a specific answer if the command is
successfully accomplished or an error message otherwise.
Terse mode can be used only if the administrator configures a user port to enter into Terse mode at login (see page 19). If a
keyboard-based user logs into a port intended for Terse mode operation, the following image will appear:

From Terse mode, a limited number of functions are possible;
Terse mode commands
 Connect to port
Send or type in:
[C] xx [Enter]
where xx is the port index number. The answer will be:
If an error occurs (i.e. the port is not accessible), the answer will be:
Err [CR][LF]
 Accessible host list
Send or type in:
[H] [Enter]
The answer may be, for example:
02,03,04,05,06,07,08,09,10,11,12,13,14,15,16 [CR][LF]
(the accessible hosts, separated by commas)
 Port info
Send or type in:
[P] xx [Enter]
where xx is the accessible port index number. The answer may be, for example:
04,H, 9600,8N1 ,N,QS,1X [CR][LF]
where the comma separated fields stand for:
- port index number;
- port type: U or H for User or Host;
- port baud rate;
- data bits (5..7), parity (N, E, O for None, Even, Odd), stop bits (1, 1.5, 2,);
- flow control (N, H, S, B for None, Hard, Soft, Both respectively);
- in-band (soft) flow control Xon and Xoff characters (in this example Xon = [Ctrl+Q] and Xoff = [Ctrl+S]);
- disconnect sequence length and sequence (i.e. “0 ” for none, “1X ” for 1-char [Ctrl+X] sequence, “3```” for 3-char ```
If the port is not accessible to the user, the answer will be:
Err [CR][LF]

Let me know if this info make any sense
Zaaf Aba

A good example with explanation