Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Script Telnet

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,38306
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
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!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Script Telnet - 10/3/2006 5:55:56 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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
 
 
Revisions: 2 | Post #: 1
 
 RE: Script Telnet - 10/12/2006 8:28:50 PM   
  est

 

Posts: 39
Score: 0
Joined: 10/12/2006
Status: offline
Try MSWinsock.Winsock.1 in VB6, also scriptable with wsh, that's a 107KB mswinsck.ocx

_____________________________

Do NOT program in a programmer's way

(in reply to DiGiTAL.SkReAM)
 
 
Revisions: 1 | Post #: 2
 
 RE: Script Telnet - 10/13/2006 12:06:11 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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

(in reply to est)
 
 
Revisions: 1 | Post #: 3
 
 RE: Script Telnet - 10/13/2006 1:19:45 AM   
  est

 

Posts: 39
Score: 0
Joined: 10/12/2006
Status: offline
Here is the very very very simple solution.

Import this to your registry and mswinsock will be OK!

..............the specific reg code was removed........

Unfortunately Microsoft regards this as a violation of COPYRIGHT, so please just import these keys just for testing, do not use them in your script.


2006-10-14 edited by est: Sorry everyone, I just wanted to test mswinsock object in vbs. I didn't mean to violate the copyright.

< Message edited by est -- 10/13/2006 3:08:38 PM >


_____________________________

Do NOT program in a programmer's way

(in reply to DiGiTAL.SkReAM)
 
 
Revisions: 1 | Post #: 4
 
 RE: Script Telnet - 10/13/2006 1:30:38 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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

(in reply to est)
 
 
Post #: 5
 
 RE: Script Telnet - 10/13/2006 7:44:26 AM   
  mcds99


Posts: 441
Score: 4
Joined: 2/28/2006
Status: offline
This should let me get to the Cisco routers and do configutation in VBS insted of Perl.

I'll let you know.

_____________________________

Sam

Keep it Simple Make it Fun KiSMiF

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 6
 
 RE: Script Telnet - 5/8/2007 2:15:35 AM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
COOL SCRIPT MAN!!! great job.
i was doing telnet with TST10.exe
cheers

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 7
 
 RE: Script Telnet - 7/5/2007 3:15:58 AM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
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

(in reply to 4scriptmoni)
 
 
Post #: 8
 
 RE: Script Telnet - 6/23/2008 11:34:10 AM   
  simon

 

Posts: 8
Score: 0
Joined: 6/6/2008
Status: offline
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.

Any ideas?

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 9
 
 RE: Script Telnet - 6/24/2008 12:01:30 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
Are you restricted to VBS? I suspect this would be trivial in PowerShell.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to simon)
 
 
Post #: 10
 
 RE: Script Telnet - 6/29/2008 6:22:26 PM   
  4scriptmoni


Posts: 208
Score: 0
Joined: 5/3/2007
Status: offline
You can easly check if the connection was successfully or not.
Check out my post
http://www.visualbasicscript.com/m_60280/tm.htm

Like

      

_____________________________

Enterprise Microsoft Scripts
Exchange, Login/Logout Monitor,TS, Monitoring, Security, AD, etc...
http://www.felipeferreira.net

(in reply to simon)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Script Telnet Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts