Hi everyone,
i'm trying to create a batch file that telnets into a Router and picks up IP stats.
I got a template from someine that i trying to adapt but i have run into problems. I get the error message below:
Too many parameters - "LKSW3C"
Environment variable uid [lindex $argv not defined
Too many parameters - "\r"
Environment variable pass [lindex $argv not defined
Environment variable nopass not defined
match was unexpected at this time.
I've tried to debug it on y own but not much progress yet. The entire config is pasted below as well. I need as much help as i can get on this.
Regards
MuksieB
@ECHO OFF
C:
CD\RemoteTelnet
if exist telnet.txt del telnet.txt
CALL >> Telnet.TXT
start telnet [lindex $argv 0]
append telnet "LKSW3C"
set uid [lindex $argv 1]
append uid "\r"
set pass [lindex $argv 2]
set nopass "null"
if {[string match $nopass $pass]} {
set pass ""
}
append pass "\r"
expect "Password:"
send $CISCO
expect "*> "
send "en\r"
expect "Password:"
send $Cisco2
expect "*#"
set cmd [lrange $argv 4 end]
append cmd " sh ip accounting "
append cmd [lindex $argv 3]
append cmd "\r"
send $cmd
expect "*#"
set cmd "sh version "
append cmd [lindex $argv 3]
append cmd "\r"
send $cmd
expect "*#"
send "disable\r"
expect "*>"
send "logout\r"
i'm trying to create a batch file that telnets into a Router and picks up IP stats.
I got a template from someine that i trying to adapt but i have run into problems. I get the error message below:
Too many parameters - "LKSW3C"
Environment variable uid [lindex $argv not defined
Too many parameters - "\r"
Environment variable pass [lindex $argv not defined
Environment variable nopass not defined
match was unexpected at this time.
I've tried to debug it on y own but not much progress yet. The entire config is pasted below as well. I need as much help as i can get on this.
Regards
MuksieB
@ECHO OFF
C:
CD\RemoteTelnet
if exist telnet.txt del telnet.txt
CALL >> Telnet.TXT
start telnet [lindex $argv 0]
append telnet "LKSW3C"
set uid [lindex $argv 1]
append uid "\r"
set pass [lindex $argv 2]
set nopass "null"
if {[string match $nopass $pass]} {
set pass ""
}
append pass "\r"
expect "Password:"
send $CISCO
expect "*> "
send "en\r"
expect "Password:"
send $Cisco2
expect "*#"
set cmd [lrange $argv 4 end]
append cmd " sh ip accounting "
append cmd [lindex $argv 3]
append cmd "\r"
send $cmd
expect "*#"
set cmd "sh version "
append cmd [lindex $argv 3]
append cmd "\r"
send $cmd
expect "*#"
send "disable\r"
expect "*>"
send "logout\r"