Windows Server 2003
1822430 Members
2909 Online
109642 Solutions
New Discussion юеВ

Telnet Using batch file

 
Khalid Shakoor
Regular Advisor

Telnet Using batch file

Hi,
i want to telnet using batch file from windows machine to Unix.Some one tell me how can i do this.

Thanks in advance
10 REPLIES 10
Igor Karasik
Honored Contributor

Re: Telnet Using batch file

With native windows telnet client you have very limited scripting possibilities.

Look "Telnet Scripting Tool":
http://www.freewareweb.com/cgi-bin/archive.cgi?download=1&ID=645

Or, if you have some Perl knowledge:
http://www.perlfect.com/articles/telnet.shtml
http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm
Roman Belsky
Advisor

Re: Telnet Using batch file

From Windows machine you can create simple BAT file and use Telnet.exe command-Line parameters. See detailed description here:

http://technet2.microsoft.com/windowsserver/en/library/ddf8b035-9035-475c-ae50-1d97bde83dba1033.mspx?mfr=true
Phil.Howell
Honored Contributor

Re: Telnet Using batch file

use kermit and you can script your connection
http://www.columbia.edu/kermit/case12.html

Phil
Khalid Shakoor
Regular Advisor

Re: Telnet Using batch file

Dear All
Thanks for your reply
can some one tell me how can i pass the username and password in batch file.After execute the script its prompt for password.
savus
Advisor

Re: Telnet Using batch file

Hello,
I used with succes Tera term pro:

http://hp.vector.co.jp/authors/VA002416/teraterm.html

I managed to create a script that is making telnet to a network switch and does a enable or disable of a port. The script is called with a batch file and scheduled tasks. It works fine for me.
Stefan
schandran
New Member

Re: Telnet Using batch file

Hi All,


I have similar task like savus's post...

- I have list of SAN router Switches (McData Eclipse 2640)
- I need to pull some status output daily form these devices (<# show mgmt> & <# show environment>)
- I want to automate this process in to a script (through windows bacth file if possible or with someother script base)
- I expect the script to do telnet logins, and command execution and redirect the output to a file and semd email.

I'm a SAN guy... not good in scripting... trying to find the best way to do that.

Appreciate yourt suggestion & idea on this.

- Sathish Chandran
WFHC-WI
Honored Contributor

Re: Telnet Using batch file

Hi Sathish,

I do this with a couple tools. First, I use the freeware TST10 to establish a telnet connection. The executable reads from an input textfile like this:

HOST01 23
WAIT "username"
SEND "root\m"
WAIT "passw"
SEND "mypassword\m"
WAIT ">"
SEND "show all\m"
WAIT ">"
SEND "logout\m"

TST10 dumps the output to another textfile that I specify with a switch.

I then have a free program to send mail, BLAT. Put this together in a batchfile and make it a scheduled task, I think you will have your solution.

TST10 /r:instructions.txt /o:outputfile.txt
BLAT -attacht "outputfile.txt" -s "Telnet Results" -to MyEmailAddress@MyDomain.com


Good luck!
WFHC-WI
Honored Contributor

Re: Telnet Using batch file

schandran
New Member

Re: Telnet Using batch file

Appreciate your help! Thanks Much!
Khalid Shakoor
Regular Advisor

Re: Telnet Using batch file

Thanks,
I found one VB script it will automatically send the shutdown request the my UPS reaching on Critical LEVEL.

Its working fine for me.

Thanks for your help .

Khalid