0

I can connect to Lexmark printers via telnet to access the configuration menu and I'm trying to find a way to configure them scripting the commands (there is more than 200 printers). After successful connection here is the menu in the telnet window :

MAIN MENU
  1. Set IP address Options
  2. Set IPv6 address Options
  3. Set IP Protocol enables
  4. Set MTU.........................................   ( 1500 )
  5. Set restricted server list
  6. Set lpd options
  7. Set SNMP community name.........................   ( public )
  A. Save Changes
  X. Exit current menu
Selection: 1

Is there a way I can select for example the option 1 via a batch or shell script even if this is a telnet connection ?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • yes you can automate with run time arguments, [this](http://stackoverflow.com/questions/7013137/automating-telnet-session-using-bash-scripts) may help you – ntshetty Mar 13 '17 at 09:15
  • I was considering 'expect' but I thought this was still needing an interaction. [This](http://stackoverflow.com/questions/7729948/expect-script-issue) is the post I was searching for this morning. Thanks for your help @Thiru – Nicolas Rosa Mar 13 '17 at 15:09
  • The way to indicate that your problem has been solved is to accept an answer. You can post and accept your own answer if you like. Please don't add "(Solved)" to the title, and please don't include the answer in the question. – Keith Thompson Mar 13 '17 at 16:24
  • 1
    Instead of adding a solution to the question, please post it as an answer! and remove the "(Solved)" prefix from the title! to indicate that, [accept an answer](http://stackoverflow.com/help/accepted-answer)... – aschipfl Mar 13 '17 at 18:39
  • I've rolled back the edit to add the answer into the question. When you get a moment, please add the answer in the answer box below. It's in the revision history if you want to copy and paste it. – halfer Mar 16 '17 at 00:04

1 Answers1

0

On windows, you could run Telnet scripting tool by this command: "%_path%\TST10.exe" /r:"%_path%\telnet.txt" /o:%_out_file% with pre-created telnet.txt file:

echo %hostname% 23>telnet.txt
echo WAIT "Selection:">>telnet.txt
echo SEND "1\m">>telnet.txt

Description of telnet.exe file: First line establish connection to host, second line insctruct program to wait till string "Selection:" was received (this should guarantee whole menu was drawed in screen) and last line send keypress "1" and CRLF. Than you can continue by same way with another possible sub-menu screens.....

user2956477
  • 1,208
  • 9
  • 17