| |
RobertParker
Posts: 24
Score: 2
Joined: 6/8/2007
Status: offline
|
I wrote a script that pings a list of computernames one by one, and writes the data to several files. When I run the script on my computer each ping takes roughly 2.5 seconds, but when I run it over remote desktop it takes 30 seconds for each ping. I use remote desktop from my laptop to connect to one server, and then I remote desktop from that server to a second server. There are two seperate networks that are disconnected except through a single computer. 30 seconds doesn't seem like that long, but the list will hold several thousand names. 30 seconds/computer * 4,000 computers = a really long time( around 30 hours ). How can I adjust the ping timeout or speed the program up in anyway? Here is the code that does the pinging. I isolated the delay to this function. Function Ping(strHost) Dim objPing, objRetStatus Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & strHost & "'") For each objRetStatus in objPing If IsNull(objRetStatus.StatusCode) or objRetStatus.StatusCode<>0 then Ping = False Else Ping = True End If Next End Function
|
|