jefhal Posted September 13, 2005 Posted September 13, 2005 How would I format a script to use two diffferent collections of items at one time? Can I do this? Should I do it a different way?: Collection 1: ; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = InputBox("Get System Name","Enter target System Name:") $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $strBiosCharacteristics = $objItem.BiosCharacteristics(0) $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_BIOS" ) Endif Collection 2: ; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $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_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "PrimaryOwnerName: " & $objItem.PrimaryOwnerName & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystem" ) Endif ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
AutoChris Posted September 13, 2005 Posted September 13, 2005 Just combine them!!! expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = InputBox("Get System Name","Enter target System Name:") $strLocalPC = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $strBiosCharacteristics = $objItem.BiosCharacteristics(0) $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_BIOS" ) Endif $Output = $Output & "Computer: " & $strLocalPC & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strLocalPC & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "PrimaryOwnerName: " & $objItem.PrimaryOwnerName & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystem" ) Endif
jefhal Posted September 14, 2005 Author Posted September 14, 2005 Just combine them!!!Thank you SerialKiller. The last programming language I learned (before AutoIT) was Dartmouth Basic in 1967, so you have to humor me (you don't have to but it would be a kind thing to do --- especially for a "SerialKiller"!). I wasn't sure what the first few lines of code did, so it wasn't clear where to start combining. I appreciate your help... :"> ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
jefhal Posted September 14, 2005 Author Posted September 14, 2005 (edited) $strComputer = InputBox("Get System Name","Enter target System Name:")Any ideas why the combined script only works for the "localhost", but not for other machines on my home network? I have three WinXP-HE machines on an Asante router, etc...I get this error:>Running: (3.1.1.75):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Program Files\AutoIt3\Examples\GetCompInfoUsingTwoCollectionsOfItems.au3" C:\Program Files\AutoIt3\Examples\GetCompInfoUsingTwoCollectionsOfItems.au3 (13) : ==> Variable must be of type "Object".: $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL",$wbemFlagReturnImmediately + $wbemFlagForwardOnly) $colItems = $objWMIService^ ERRORI tried replacing the ObjGet lines with ones that added inpersonation level, but still no luck on remote machines:$objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=Impersonate}!\\" & $strComputer & "\root\CIMV2")I then tried this, but again with no success on a remote machine:$objWMIService = ObjGet("winmgmts:"& "{impersonationLevel=Impersonate," & "authenticationLevel=Pkt}!\\" & $strComputer & "\root\CIMV2")Consarn (&#$)(*@%(((XX!!!!!"(@@)!Qx;;;;'!!! just found this at MotherShip MSDN site:Failure to connectSome connections between operating system versions are not supported:You cannot connect to a computer that is running Windows XP Home Edition.Must wait until back at work on a "real" network: WinServ2003, Win2K, etc. Time to upgrade the home net to WinXP-Profe$$$$$$ional... Edited September 14, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Sundance Posted September 14, 2005 Posted September 14, 2005 Hiho, i've tried also to connect to another machine with Win XP on it and got the same error. Any further suggestions ? I also have admin rights on the inspected client with the logon-name on my machine. With another peace of software (LicAdo) i can read out the hole client. LicAdo does it also with WMI-routines.. mmhhhh must be a simple thing i guess... i will give info if i have found the prob bye
jefhal Posted September 14, 2005 Author Posted September 14, 2005 Any further suggestions ?Sundance, are you using WinXP Home Edition? If so, none of this will work. See my last edit above in this thread. You can see my slide into oblivion in slow motion... ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
Sundance Posted September 15, 2005 Posted September 15, 2005 (edited) Sundance, are you using WinXP Home Edition? If so, none of this will work. See my last edit above in this thread. You can see my slide into oblivion in slow motion...<{POST_SNAPBACK}>Hi jefhal,no we have Windows XP Prof. and the DNS-Server resolves the clientname correctly.XP-Firewall ist disabled on both machines Edited September 15, 2005 by Sundance
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