jefhal Posted September 15, 2005 Share Posted September 15, 2005 Well, I searched on +alive +computer and got: alive or computer instead of alive and computer. Next, I searched one more time and found myself at the View New Posts page. What I'm looking for is any info on how to determine if a remote computer is "alive". Simply pinging it is a good start, but I can ping a machine that is plugged into a network cable but still dead otherwise. Given your choice of any property available through AutoIT Scriptomatic (WMI), which property(s) would you use? Second, for many of AutoIT Scriptomatic classes, the code that is generated finds more than one target (e.g. network adapters). If I already know which adapter to check how would I change the WQL statement to give me just that one?: $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
seandisanti Posted September 15, 2005 Share Posted September 15, 2005 Well, I searched on +alive +computer and got: alive or computer instead of alive and computer. Next, I searched one more time and found myself at the View New Posts page.What I'm looking for is any info on how to determine if a remote computer is "alive". Simply pinging it is a good start, but I can ping a machine that is plugged into a network cable but still dead otherwise. Given your choice of any property available through AutoIT Scriptomatic (WMI), which property(s) would you use?Second, for many of AutoIT Scriptomatic classes, the code that is generated finds more than one target (e.g. network adapters). If I already know which adapter to check how would I change the WQL statement to give me just that one?:$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)<{POST_SNAPBACK}>if the computer isn't powered on it won't reply to ping... Link to comment Share on other sites More sharing options...
jefhal Posted September 15, 2005 Author Share Posted September 15, 2005 if the computer isn't powered on it won't reply to ping...<{POST_SNAPBACK}>This one computer happened to have been "powered up" (i.e. the motherboard led was lit), and, therefore, I could ping it, but otherwise it was d-e-a-d. Dell is sending a powersupply and a motherboard to make it better. The point is, that even though I could ping it, it was not in a state to do the subsequent steps in my script. Maybe if I knew how to get an error back from the AutoIT Scriptomatic code in case it fails....? Right now it just hangs and I have to kill the AIT script in the task manager (ugh). ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jefhal Posted September 15, 2005 Author Share Posted September 15, 2005 Second, for many of AutoIT Scriptomatic classes, the code that is generated finds more than one target (e.g. network adapters). If I already know which adapter to check how would I change the WQL statement to give me just that one?:Here's a valid WQL query:Set colItems = objWMIService.ExecQuery( "SELECT * FROM Win32_NTLogEvent " & "WHERE Logfile = 'Application",,48)Here's what I tried in AutoIT, which didn't work:$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter" & "WHERE Caption = "[00000001] Intel(R) PRO/100 VE Network Connection", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)Here's what's actually in the "caption":[00000001] Intel(R) PRO/100 VE Network ConnectionObviously I didn't know what to do with the ",,48" in the WQL. I also couldn't find any examples at MotherShip.msdn of how to specify "contains". I.E. where $objitem.caption CONTAINS "Intel"...Clear as mud? ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
jefhal Posted September 16, 2005 Author Share Posted September 16, 2005 (edited) Here's what I tried in AutoIT, which didn't work:This did work. I just moved the test for "Intel" to outside of the WQL statement:$wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems if stringinstr($objItem.Description,"Intel") <> 0 then $Output = $Output & "Description: " & $objItem.Description & @CRLF ExitLoop endif Next msgbox(1,"Found network card",$Output) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_NetworkAdapter" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Still curious what you think would be the best property to use to confirm that a remote computer was "alive" and kicking...? Edited September 16, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format 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