rortiz77
asked on
Need a batch script that will telnet into a server and run a command
Looking for a batch script that will establish a telnet connection and then run a command. Is this even possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@activematx, your right...don't want to free text my password in there. How does this other tool not store my password? Kinda hard to make sense of it so far...
How does this other tool not store my password?
This other tool will also store your password in a text file. :(
Here is a write up of what the program does. Link: http://jerrymannel.com/blog/2008/11/11/telnet-scripting-tool-aka-tst10exe/
How about using PuTTY to fo this?
Hi SecureCRT is the BEST tool to do this automation..
Learn to use from the below link..
http://www.vandyke.com/products/securecrt/
I am using the same for telnet and run the commands which are preloaded.
Attached are the screenshots..just for reference..
Cheers!
secureCRT1.JPG
secureCRT1.JPG
Learn to use from the below link..
http://www.vandyke.com/products/securecrt/
I am using the same for telnet and run the commands which are preloaded.
Attached are the screenshots..just for reference..
Cheers!
secureCRT1.JPG
secureCRT1.JPG
ASKER
@B_Denison @skraaz,
I'm all for telnet but this needs to be something that the SQL server can execute. If so, then its a good option.
I'm all for telnet but this needs to be something that the SQL server can execute. If so, then its a good option.
ASKER
Ok, spoke with our admin and he has no concerns with using this Telnet script Tool. His server is secured enough...so he's good to go.
I've done some testing and I can't get passed the logon part. What I've done so far is that I have a text file called, "logon.txt" and an "Output.txt" file which is blank.
My logon.txt file contains:
128.#.#.# 23
WAIT "login"
SEND "username\m"
WAIT "password"
SEND "$1234\m"
WAIT ">"
SEND "ss1\m"
WAIT ">"
SEND "stop_procs\m"
WAIT ">"
I then go to the cmd and type:
TST10.exe /r:logon.txt /o:output.txt /m
but it fails to get passed the username/password.
It then shows this:
I've done some testing and I can't get passed the logon part. What I've done so far is that I have a text file called, "logon.txt" and an "Output.txt" file which is blank.
My logon.txt file contains:
128.#.#.# 23
WAIT "login"
SEND "username\m"
WAIT "password"
SEND "$1234\m"
WAIT ">"
SEND "ss1\m"
WAIT ">"
SEND "stop_procs\m"
WAIT ">"
I then go to the cmd and type:
TST10.exe /r:logon.txt /o:output.txt /m
but it fails to get passed the username/password.
It then shows this:
Welcome to Microsoft Telnet Service
login: hciuser
ciuser
password: $eveN11
The handle is invalid.
Login Failed
login:
ASKER
ok, figured out the bug. Since it always wanted me to re-enter the username and password...then the solution is to put that in twice in the script. Seems to work so far.
For what it's worth, here's another approach using the built in windows telnet client, and VBScript to automate the usage of that "command line" program. You may be all set, but thought I'd pass it along...
http://www.makeuseof.com/tag/automate-telnet-commands-vb-script/
~bp
http://www.makeuseof.com/tag/automate-telnet-commands-vb-script/
~bp
echo password | telnet -l username IPaddress
Be aware that putting unencrypted passwords into scripts/batch files is a security breach.
Alternatively you could use other languages such as perl to do this task:
Open in new window