fwilliams1
IS-IT--Management
I apologize ahead of time for my ignorance. I need to create a scrip that will read a text file for IP addresses and telnet to each of them, and execute some commands. I have been surfing the threads and they've been very helpful. I have put together some a sample script, but it isn't working. The scrip compiles and attempts to run, but it does nothing. Can someone share their $.02?
proc main
string sNum
set capture file "capturefile" ;sets caputure file to the file named in file_date proc
capture on ;turns on capture
if fopen 0 "c:\program files\symantec\procomm plus\Aspect\numbers.txt" READ TEXT ;Open text file containing list of connections
while not feof 0 ;While data remains in the file
fgets 0 sNum ;Get entry from file
if not nullstr sNum ;If entry is not blank
dial TELNET sNum ;Then dial it
while $DIALING ;Pause while dialing
yield
endwhile
pause 1
if $CARRIER ;If connected...
;perform operations here once connected...
transmit "^M"
waitfor "Username:"
transmit "*****^M"
waitfor "Password:"
transmit "*****^M"
waitfor ">"
transmit "en^M"
waitfor ">"
transmit "*****^M"
waitfor "#"
transmit "term len 0^M"
waitfor "#"
transmit "show ver^M"
waitfor "#"
transmit "exit"
endif
endif
endwhile
endif
fclose 0 ;Close data file
capture off ;turns capture off
endproc
proc main
string sNum
set capture file "capturefile" ;sets caputure file to the file named in file_date proc
capture on ;turns on capture
if fopen 0 "c:\program files\symantec\procomm plus\Aspect\numbers.txt" READ TEXT ;Open text file containing list of connections
while not feof 0 ;While data remains in the file
fgets 0 sNum ;Get entry from file
if not nullstr sNum ;If entry is not blank
dial TELNET sNum ;Then dial it
while $DIALING ;Pause while dialing
yield
endwhile
pause 1
if $CARRIER ;If connected...
;perform operations here once connected...
transmit "^M"
waitfor "Username:"
transmit "*****^M"
waitfor "Password:"
transmit "*****^M"
waitfor ">"
transmit "en^M"
waitfor ">"
transmit "*****^M"
waitfor "#"
transmit "term len 0^M"
waitfor "#"
transmit "show ver^M"
waitfor "#"
transmit "exit"
endif
endif
endwhile
endif
fclose 0 ;Close data file
capture off ;turns capture off
endproc