Prodigus Posted June 3, 2006 Share Posted June 3, 2006 I know this isn't the best code in the world but I'm just trying to learn. I'm wondering if there's some happy medium between a RunWait and actually putting a pause in the Red area below. You see, if a computer is offline then the logparser has to time out before I can go on to the next computer on my list. I would rather not wait any longer that 3 seconds before going on to the next one as if the computer is online it normally only takes about 0.3 seconds to get the result. I would rather just leave that one blank and go on.Is pause and RunWait my only 2 options?Func CreateVar1() ;gathers the image type and IPAddress of each computer that was gathered by GatherComp Function $mfile = FileOpen("MYMACHINES.txt", 0) If $mfile = -1 Then Return While 1 $var1 = FileReadLine($mfile) If @error = -1 Then FileClose ($mfile) ExitLoop EndIf $sCmd2Run2 = "logparser ""SELECT Value INTO ip.txt FROM ""\\"&$var1&"\HKLM\SYSTEM\CurrentControlSet\Services\TCPIP"" WHERE ValueName = 'DhcpIPAddress'"" -i:REG -o:TSV -headers:off" $sErrorStatus = RunWait($sCmd2Run2, @ScriptDir, @SW_HIDE) $ipfile= Fileopen("ip.txt", 0) $var2= FileReadLine($ipfile) If @error = -1 Then FileClose ($ipfile) ExitLoop EndIf FileClose($ipfile) FileOpen($ofile, 1) FileWriteLine ($ofile,$var1 & "," & $var2) FileClose($ofile) FileDelete ( "ip.txt" ) WEndEndFuncThanks,Prod Link to comment Share on other sites More sharing options...
Nomad Posted June 3, 2006 Share Posted June 3, 2006 Or a conditonal loop, that's all I can think of. But there are many different conditions you can set depending on what you need. Link to comment Share on other sites More sharing options...
JMiller Posted June 4, 2006 Share Posted June 4, 2006 You could try the Ping() function with a timeout to see if the system responds before you run logparser.exe. Link to comment Share on other sites More sharing options...
Bert Posted June 4, 2006 Share Posted June 4, 2006 The conditional loop world work well here. If you do not get the responce in 600ms, (6/10 of a second) then do a ping to see if the pc is there. if no responce, then responce is blank , and exitloop to the next PC to check. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Prodigus Posted June 4, 2006 Author Share Posted June 4, 2006 yup, that works great!! Thanks!! Of course now that that works I found a new problem where some machines somehow have 2 DhcpIPAddresses but that's another story... Perhaps I can get the IP address from DNS or perhaps just by pinging it.. We'll see.. Thanks !!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now