Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


MULTITHREADING

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MULTITHREADING
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1] 2 3   next >   >>
Login
Message << Older Topic   Newer Topic >>
 MULTITHREADING - 3/14/2005 7:22:16 AM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
Can VBScript run shell commands in the "background"?

For example:

Set objShell = CreateObject("WScript.Shell")
objShell.run "ping 127.0.0.1"


Can the Shell object execute ping without launching the console? In this example, would it be objShell.somethingelse?

I'm also curious if anyone's had any experience working directly with Icmp.dll; pinging multiple hosts simultaneously on separate threads (which is ultimately what I'm trying to do ).

Thanks...GLM
 
 
Post #: 1
 
 Re: MULTITHREADING - 3/14/2005 7:49:10 AM   
  mbouchard


Posts: 1863
Score: 14
Joined: 5/15/2003
From: USA
Status: offline
you could use WMI to ping without the need for the console.

      

(in reply to giantlunarmoth)
 
 
Post #: 2
 
 Re: MULTITHREADING - 3/14/2005 7:59:28 AM   
  tnoonan

 

Posts: 364
Score: 0
Joined: 12/14/2004
From:
Status: offline
http://www.ostrosoft.com/icmp_component/using_vbscript.asp

(in reply to giantlunarmoth)
 
 
Post #: 3
 
 Re: MULTITHREADING - 3/14/2005 8:28:41 AM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
Excellent...thank you both. The WMI solution is a breeze to implement, and executes quickly. OSICMP.dll is pretty dang cool in its own right.

Thanks for your help.

(in reply to giantlunarmoth)
 
 
Post #: 4
 
 Re: MULTITHREADING - 3/14/2005 9:45:49 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
How would you have multiple threads running simultaneously within the script though ?

(in reply to giantlunarmoth)
 
 
Post #: 5
 
 Re: MULTITHREADING - 3/14/2005 1:44:48 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
I'm actually tryin to figure out how, conceptually, I can do anything simultaneously in a script. I have an app called MultiPing (not the Nessoft version)...mine is by one Thomasz Stelmach, and doesn't seem to have a home anymore. Anyway, if I remember correctly, on his now defunct webpage Thomas was explaining how Icmp.dll could support up to 50 simultaneous threads. I recently thought "there's gotta be a way to do this in a script!"...send a packet apiece to 50 hosts, then 50 more, etc. That would make pretty short work of speciallized network polling...still tryin to figure it out. :)

(in reply to giantlunarmoth)
 
 
Post #: 6
 
 Re: MULTITHREADING - 3/14/2005 2:47:33 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Since vbs is interpreted and requires cscript (or wscript) to run, isn't the multithreading capabilities of the script itself controlled or limited by cscript in some way ? Is cscript multithreading capable ?

This is quite interesting.

(in reply to giantlunarmoth)
 
 
Post #: 7
 
 Re: MULTITHREADING - 3/15/2005 2:23:50 AM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
I came across ThreadForker.vbs at http://cwashington.netreach.net/depo/view.asp?index=614&scripttype=vbscript. I'm curious what you guys make of this.

(in reply to giantlunarmoth)
 
 
Post #: 8
 
 Re: MULTITHREADING - 3/15/2005 7:48:55 AM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
I downloaded OSICMP.dll and the associated sample script "ping.vbs" from the link tnoonan provided above. Upon running ping.vbs, I was struck by the fact that the command output was being echoed to the "same" messagebox one line at a time. Actually, it appears as though each reply line gets its own box, but the box includes each previous reply, simulating "realtime" feedback. I think this may have some relevance to Juan Avila's post http://www.visualbasicscript.com/topic.asp?TOPIC_ID=2329 where he is trying to get realtime output into one messagebox.

The code of ping.vbs is below...I'm curious if anyone can detect any features in the script itself that would facilitate this method of stdout redirection, or if it's just a feature of the 3rd party dll. I've tried removing all OSICMP referrences, and substituting regular ping functions, but just get the one line per pop-up.


      

(in reply to giantlunarmoth)
 
 
Post #: 9
 
 Re: MULTITHREADING - 3/15/2005 8:36:01 AM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I'm not complaining or anything; I thought that the ThreadForker was something "real". Nonetheless, it is an interesting way of simulating multiple threads, and I've never thought of something like that before.

What exactly do you intend to achieve by ping the computers though ?

(in reply to giantlunarmoth)
 
 
Post #: 10
 
 Re: MULTITHREADING - 3/15/2005 10:59:13 AM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
My superiors like to call in for up/down status on several so-called critical servers. In between our massive snmp polling cycles, it's nice to be able to get an instant status report. I already use batch and perl scripts for this and other things, but the reported "power" of WMI was quite seductive...the goal being to eventually get more than "up/down" status.

My interest in multithreading is very general, and, at this point, is fueled more by fantasy than practical application. We've many many thousand nodes, and I've found myself running, by "hand", several instances of the same script againts different chunks of hosts to save time...this is terrible practice, and ruins my day. :)

(in reply to giantlunarmoth)
 
 
Post #: 11
 
 Re: MULTITHREADING - 3/15/2005 1:40:56 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
For the purpose of pinging, the results are important. In order to catch these results sent to the stdout, we will need to use files or EXEC. Simulating multithreading in this manner has its benefits of allowing us to set an arbitrary number of threads dynamically. The trick here is to determine how to track and use these results correctly and efficiently. In the case of using WMI or SICMP.Ping, it is rather difficult to dynamically change the number of threads and it is just might be as difficult to track the results.

I use WMI for determining the online status of a host on roughly 4000 hosts on a daily basis and it seems to be good enough for me under most circumstances.

(in reply to giantlunarmoth)
 
 
Post #: 12
 
 Re: MULTITHREADING - 3/15/2005 2:53:59 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
Yes, getting precise results has always been a bit dicey for me. I used to use batch tokens, but would get erroneous positives, as border routers will return replies (i.e., "destination host unreachable") for down hosts depending on the circumstances (although, using the 9th token works pretty well most of the time: FOR /F "tokens=9" %%A IN ('ping -n 3 -w 3000 %IP%') DO whatever).

I'm fairly committed to sticking with WMI goin forward, as I'm tired of making all of these "niche" scripts. I'm curious as to the properties of Win32_PingStatus in terms of customization. Say a data circuit goes down, but a host is still up on a fail-over system (i.e., satellite)...can we adjust the timeout and extend the packet count to compensate? Or does WMI automatically keep trying for a certain amount of time?

(in reply to giantlunarmoth)
 
 
Post #: 13
 
 Re: MULTITHREADING - 3/15/2005 3:54:48 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I don't think you can adjust the timeout though. If memory serves me right, it is 1000ms.

Poor you, I can't even begin to imagine using batch FOR LOOP to parse the ping reply. =) I would've died instantly

(in reply to giantlunarmoth)
 
 
Post #: 14
 
 Re: MULTITHREADING - 3/15/2005 4:59:49 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
Lol...I've had the same empathy for myself many a time . I think I have an inherent "when in Rome" mentality that predisposes me to shell scripting (I'm a bash-loyalist in Solaris as well). This drives my Perl-geek co-workers nuts...they've all had too much Cult of Larry Kool-Aid ("Hail Perl"). The only thing I use Perl for really is the Net::Telnet module, which is, admittedly, pretty damn useful (MS screwed us in the telnet dept.). Batch scripting's surely a trial, but it's my entrance into this whole game...and hell, it works right? Our production network is 90% windows, so I'm hoping WMI will become my secret weapon.

(in reply to giantlunarmoth)
 
 
Post #: 15
 
 Re: MULTITHREADING - 3/15/2005 5:09:24 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
BTW token, do you have any thoughts on simulating real-time line echo to a single msgbox?

(in reply to giantlunarmoth)
 
 
Post #: 16
 
 Re: MULTITHREADING - 3/15/2005 5:30:44 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
I don't think you can appened any data using msgbox.

(in reply to giantlunarmoth)
 
 
Post #: 17
 
 Re: MULTITHREADING - 3/15/2005 5:39:59 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
Right, but do you know how the above script is simulating it?

(in reply to giantlunarmoth)
 
 
Post #: 18
 
 Re: MULTITHREADING - 3/15/2005 5:44:16 PM   
  token

 

Posts: 1917
Score: 0
Joined: 1/14/2005
From:
Status: offline
Above script ? ThreadForker ?

(in reply to giantlunarmoth)
 
 
Post #: 19
 
 Re: MULTITHREADING - 3/15/2005 5:52:14 PM   
  giantlunarmoth

 

Posts: 47
Score: 0
Joined: 3/9/2005
From:
Status: offline
No...sorry, I should have specified. It's code I got from the site tnoonan posted earlier in this thread. I posted the vbs code a few posts later.

(in reply to giantlunarmoth)
 
 
Post #: 20
 
 
Page:   [1] 2 3   next >   >>
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> MULTITHREADING Page: [1] 2 3   next >   >>
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