Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet Loop w/Text File 2

Status
Not open for further replies.

fwilliams1

IS-IT--Management
Nov 8, 2006
2
US
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
 
I have a few programs that look almost identical except for the following:

Code:
dial TELNET sNum                       ;Then dial it

I use:

Code:
connectmanual TELNET sNum

See if that works for you.
 
I BELIEVE (I could be wrong), that DIAL only works for items in your connection directory, and you can't just use a # or an IP address.

connectmanual allows you to enter a # or IP directly.

Someone correct me if I'm wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top