|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ping subnetvbscript. I am try to ping more than one IP at a time, currently I can ping a group of ips using a loop but this is slow. How can I create multiple ping windows and run "x" amount of jobs at the sametime. here is my code so far '===================================== 'Ping Subnet ' '===================================== On Error Resume Next 'setup IP variables strSubnet = "114.16.149." 'define subnet dim count2 'counter used to convert count to a string dim count 'used to create ip addresses 'setup file to store returned data dim filesys, filetxt, getname, path Set filesys = CreateObject("Scripting.FileSystemObject") Set filetxt = filesys.CreateTextFile("c:\somefile.txt", True) path = filesys.GetAbsolutePathName("c:\somefile.txt") getname = filesys.GetFileName(path) 'create ip address and ping using wmi pingstatus for count = 1 to 10 count2 = Cstr(count) strTarget = strSubnet + count2 'IP address or hostname Set objShell = CreateObject("WScript.Shell") Set objExec = objShell.Exec("ping -n 2 -w 1000 " & strTarget) strPingResults = LCase(objExec.StdOut.ReadAll) If InStr(strPingResults, "reply from") Then WScript.Echo strTarget & " responded to ping." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strTarget & "\root\cimv2") Set colCompSystems = objWMIService.ExecQuery("SELECT * FROM " & _ "Win32_ComputerSystem") For Each objCompSystem In colCompSystems filetxt.WriteLine(strTarget & " " & objCompsystem.Name) 'write results to file WScript.Echo "Host Name: " & LCase(objCompSystem.Name) Next Else WScript.Echo strTarget & " did not respond to ping." End If strTarget = "" filetxt.Close 'close file next From: "charles@home" <charles@h***@discussions.microsoft.com> I'm not sure the IP stack can handle it and are you really sure you want to put that much| Hello everyone, this is my first post. I am new to the programming world of | vbscript. I am try to ping more than one IP at a time, currently I can ping | a group of ips using a loop but this is slow. How can I create multiple ping | windows and run "x" amount of jobs at the sametime. | | here is my code so far traffic on the LAN ? Yes, only like 10 pings at a time, I seen it done in the past, I not sure how
he did it. What I seen was 60 command windows gathering data from different host at the same time. Show quoteHide quote "David H. Lipman" wrote: > From: "charles@home" <charles@h***@discussions.microsoft.com> > > | Hello everyone, this is my first post. I am new to the programming world of > | vbscript. I am try to ping more than one IP at a time, currently I can ping > | a group of ips using a loop but this is slow. How can I create multiple ping > | windows and run "x" amount of jobs at the sametime. > | > | here is my code so far > > > I'm not sure the IP stack can handle it and are you really sure you want to put that much > traffic on the LAN ? > > -- > Dave > http://www.claymania.com/removal-trojan-adware.html > http://www.ik-cs.com/got-a-virus.htm > > > "charles@home" <charlesh***@discussions.microsoft.com> wrote in message So basically you want a multi-threaded VBScript :) You would need to launch news:4FAE0432-F733-4CA0-98B4-D1ED14E0DE51@microsoft.com... > Yes, only like 10 pings at a time, I seen it done in the past, I not sure > how > he did it. > What I seen was 60 command windows gathering data from different host at > the > same time. > > "David H. Lipman" wrote: multiple instances of the scripting engine (CScript.exe). The first script would read the list of computer names and then launch another instance of cscript.exe (or cmd.exe /c ping.exe) for each computer. That's the easy part, the tricky part is how do you get the results back into the overall process. Each instance could write the result to it's own text file, or they could all write to the same file but you have to deal with file locks if multiple writes happen at the same time. If each child script can do all the work it needs to on it's own, without reporting back to the parent script that would be easier. Explain what it is you will do with the data, and what format you want the results in, etc.
Show quote
Hide quote
"Marty List" <use***@optimumx.com> wrote in message Just a few thoughts: Build a dictionary object with all of the IPnews:eFFLM9UnFHA.1204@TK2MSFTNGP12.phx.gbl... > > So basically you want a multi-threaded VBScript :) You would need to launch > multiple instances of the scripting engine (CScript.exe). The first script > would read the list of computer names and then launch another instance of > cscript.exe (or cmd.exe /c ping.exe) for each computer. That's the easy > part, the tricky part is how do you get the results back into the overall > process. Each instance could write the result to it's own text file, or > they could all write to the same file but you have to deal with file locks > if multiple writes happen at the same time. > > If each child script can do all the work it needs to on it's own, without > reporting back to the parent script that would be easier. addresses needing to be scanned, then, as you suggest, launch multiple copies of 'cscript.exe' for each IP address & have the child scripts create volatile variables with the results. The main script could launch all of the child scripts at once and then wait in a loop for all of them to finish. It could then walk the dictionary object, matching to the volatile variables and copying the value from the variable into the 'Item' field of the dictionary key. On Tue, 9 Aug 2005 19:58:57 -0400, "David H. Lipman"
<DLipman~nospam~@Verizon.Net> wrote: >I'm not sure the IP stack can handle it and are you really sure you want to put that much The IP stack can definitely handle this. As written the script>traffic on the LAN ? Charles put together would only ping each address twice. A scope of 254 addresses doubled would be 508, doubled again for the replies, would be 1,016 packets over more than 10 seconds. Each packet ICMP packet would likely take up a 64 byte ethernet frame, so this would likely take 6,502 bytes of IP over eithernet traffic per second. Considering that a 100Mb connection can do 12,500,000 bytes per second, we're probably covered. Now, we're the majority of the traffic on a LAN will come from is from the ARP broadcasts. The total amount of bytes will depend on how many nodes are on the network (assuming a switched network... does anyone use hubs anymore?). Each ping will cause an ARP to be sent except for know MAC addresses. ARP traffic will typically hit every node on the VLAN/collision domain. If an ARP reply is not received by the time the 2nd Ping packet is ready to be sent then another ARP request is sent via broadcast. So the worst case is that two ARP requests are sent out for each IP and there is one successful ping packet sent and a reply received. That would be about 43,300 frames per second ((254^2 * 2 + half of the ping packets), which to make the math simple would take about 1/3 of a percent of the possible bandwidth. Here's a batch routine I put together for getting MAC addresses quickly, and I watched a Sniffer while testing this. http://groups.google.com/group/microsoft.public.win2000.cmdprompt.admin/msg/dfc3acf5a689b214?hl=en& Thanks, Clay Calvert CCalv***@Wanguru.com Replace "W" with "L"
login script in win2k domain
vbscript to change IE Proxy Script not work with server 2003 Extracting Numerical Values from a Text File WMI filter for IPAddress Automate Remote log off of users Stopping Processes - Permission Errors Logon script variable help in vbscript how could I get all the computer name in a group which are running? |
|||||||||||||||||||||||