Jump to content

What other options besides Pause and RunWait?


Recommended Posts

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" )

WEnd

EndFunc

Thanks,

Prod

Link to comment
Share on other sites

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 !!! :D

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...