Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBScript and Telnet

$
0
0

Below is my script. Basically it is a sample script. I use it to test run the VBScript and Telnet. I has been working for a while. Then it stopped working. When I go to the command prompt and manually open a telnet session. It works. My login and password works. However . . . When I try to do the same thing with VBScript, it stops at the password. And then it times out.

What do you think is the problem? How to fix?

My code:

<job>
<script language="VBScript">

Option Explicit
On Error Resume Next
Dim WshShell
set WshShell=CreateObject("WScript.Shell")
WshShell.run "cmd.exe"
WScript.Sleep 1000

WshShell.SendKeys "telnet xx.xx.xx.xx 23"
WScript.Sleep 1000
WshShell.SendKeys ("My ID")
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys ("My Password")
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "1"
WScript.Sleep 1000
WshShell.SendKeys ("{Enter}")

- DO STUF HERE 

WshShell.SendKeys "exit"
WshShell.SendKeys ("{Enter}")
WScript.Quit

</script>
</job>


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>