Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Automating the run-config output

run-config is great output and is used with WLC Analyser tool.

Here is a way to make it more automatic

1st) make sure you are at a code level that supports run-config upload

     Run  the command: transfer upload run-config to see if the controller supports it.

This is a re-hash of some old scripts I've written. See:

Here is the script:




Prior to running it:

(Optional) In /tftpboot (or where you specified below)  touch the file you want to call it, make sure you change it in the expect file too.

chmod a+w the file

run it as follows:  ./ <controller ip>  <read-write user> <password>

Bash script that calls the command script:



# 2011 Eric Garnel

# expect script to pull info from WLC controllers

# set the output directory


# Usage- call script with variables


# ./ <wlc ip> <username> <password> <controllername>


# change path as needed

# example: path_to_scriptsdir=/tmp





output=$($path_to_scriptsdir/wlc-run-conf.exp $router $username $password)

run=$(echo $output)

exit 0

Expect script that runs the actual commands:



set router [ lindex $argv 0]

set username [ lindex $argv 1]

set password [ lindex $argv 2]

spawn ssh $router

#log_user 0

set timeout 10

expect "(yes/no)?" {

send "yes\r"; exp_continue }

expect "User:"

send -- "$username\r"

expect "Password:"

send -- "$password\r"

expect "Controller"

send -- "config paging disable\r"

# some wlc config commands require yes/no verification

# set the data type to run-cofig

expect "Controller"

send -- "transfer upload datatype run-config\r"

# set the serverip here.  Sorry, it must be hard-coded as my coding skills suck

expect "Controller"

send -- "transfer upload serverip\r"

# tell it what file on the tftp server to save as.  I touched the file manually in advance just to be sure

expect "Controller"

send -- "transfer upload filename 2504-run\r"

# Kick it off

expect "Controller"

send -- "transfer upload start\r"

expect "(y/N)"

send -- "y\r"

# logout of controller

expect "Controller"

send "logout\r"

Version history
Revision #:
1 of 1
Last update:
‎05-21-2013 11:31 AM
Updated by: