Is it possible to use the Windows Telnet client to run a series of commands in a script?
If not are there any alternatives that can be?
|
|
Ages ago I wrote a COM server to allow me to do telnet from VBScript. If you want a copy (including source) I'd be happy to put it on the Internet somewhere. I use it for remotely rebooting routers. To give you some idea of what it does, here's an example script (with error checking removed)
JR Link to COM Server: hi Lachlan try http://www.ratsauce.co.uk/RouterCheck.zip This is the COM server and a script to reboot a Draytek router. The script RouterCheck.wsf checks if it can ping a couple of test hosts, so you'll probably want to ignore most of the code. Just use the RebootRouter function and ignore the rest. This is at the end of my ADSL line so the download may be a bit slow. If anyone wants the source (Visual C++ 5.0 with ATL) then I can drop it on SourceForge. |
|||||||
|
|
Yes. Check out this thread. |
|||||||
|
|
You could install Perl and use Net::Telnet, which lets you both send and interpret the received data. ActivePerl is probably the quickest way to get up and running with this: http://www.activestate.com/activeperl/ And Net::Telnet is documented here: http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm Further questions about how to code using Net::Telnet probably belong on StackOverflow. You may also want to look at www.perlmonks.org for examples and tips. |
|||
|
|
|
I know this is a terribly old thread, but I came here from a related question and noticed that a very obvious answer was missed. Ever heard of putty? There's a command line scriptable version called plink. |
|||
|
|
|
If you don't mind a commercial solution, there a business telnet client called TeSSH, that has a rich scripting language, and can be run from the command-line. It has support for writting scripts in vbs, perl, and lua. It's fairly inexpensive at $34.95. You can also visit the TeSSH Support Forums. |
|||
|
|