All Forums >> [Scripting] >> Post a VBScript >> Script Telnet Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Recently, I was looking through google, trying to figure out how to script my telnet session. I also found quite a number of posts on here that were struggling with the task. Finally, I came across a freeware DLL that can be accessed via CreateObject(). It is called w3sockets, and it is by dimac.net. The download location is here. Here is the location of the documentation for it. One of the nice things about this is that it does not show a popup window at all. One word of warning... the TimeOut value does not work, and always defaults to 20 seconds, no matter what value you put in.
Here is a script that demonstrates the use of the object to telnet to an IP address and check for the existence of MS Exchange.
Another note: There is an object by ActiveExperts, The ActiveSocket Network Communication Toolkit that does the same kind of thing, along with some other functionality. It is a nicer object, overall, but it does come with a $US140/10 computer license fee. Since I prefer to NOT pay for things if there is a free/public domain alternative, I went with w3Sockets.
EDIT(EBGREEN): Added the correction that DM added a few posts down.
< Message edited by ebgreen -- 7/5/2007 3:40:48 AM >
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers)
"It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
Generally, you will have problems using this control in VBScript unless you have a Visual Studio or other design app installed on your PC. You will get license errors, etc. A way around this, however is to go to here and download another ocx which will then act as a wrapper for the first ocx. Now, granted, you will then have access to a bunch of other fucntionality, but ya know, it is much easier to use just a single activex component and teh previous simple code example - at least in my mind. But by itself, mswinsck.ocx is, unfortunately, not generally scriptable via vbscript.
< Message edited by DiGiTAL.SkReAM -- 10/13/2006 12:08:35 AM >
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers)
"It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
While I am sure everyone appreciates your efforts, if it is a violation of copyright, it shouldn't be posted to the fora. I am well aware that there are many ways to 'get around' various limitations, but not all of them are aboveboard, and therefore are not proper material for posting here, at least as I understand the rules and the admins' wishes.
Plus, 99.9% of my scripting is used in a business environment and must therefore be very stringent concerning anything the authorities might frown upon.
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers)
"It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
I apologize folks it wasn't until just now that I realized the script wasn't correct. There were a couple of line missing, as it was just the bare function, but without the function name() and end function lines, etc. And, since I am apparently not allowed to edit previous messages.??? I will post it here.
MAKE SURE THAT YOU HAVE THE DLL REGISTERED PROPERLY
Here is a working script.
_____________________________
"Would you like to touch my monkey?" - Dieter (Mike Meyers)
"It is better to die like a tiger, than to live like a pussy." -Master Wong, from Balls of Fury
ok so i figure i am going to have to use telnet for this, because i am required to test specific ports to see if they're open.
ive got a script to run telnet through a command prompt, but i'm having trouble getting it to return a value to tell if it has successfully connected or not.