stamandster 5 Posted January 24, 2011 (edited) Morning! I'm trying to convert a UINT16 (and possibly UINT32) into usable information, specifically for the Win32_PnPEntity class "Availability" property. I can't for the life of me figure out how to do this properly; keeps displaying 0 instead of something like 0x1. Perhaps I'm just "doing it wrong". Information regarding this WMI class is shown here http://msdn.microsoft.com/en-us/library/aa394353%28v=vs.85%29.aspx . And I was able to find a VB way of handling this http://msdn.microsoft.com/en-us/library/8444cfyw.aspx but again I'm unsure on how to relate this to AutoIT. There's also this codeguru WMI enumeration script that talks about it http://www.codeproject.com/KB/scripting/wmiadmin.aspx . Any help would be much appreciated and you'll have my accolades Edited January 24, 2011 by kickarse [size="1"]Windows Updates Finder - Works with XP/2003/Vista/W7/08 and Remotely[/size][size="1"]IniReadSectionEx - Read Large INI Sections[/size][size="1"]Migrate Printers UDF - Like Printer Migration from MS[/size] Share this post Link to post Share on other sites
PsaltyDS 39 Posted January 25, 2011 There is nothing special about a UINT type, it's just a number. The problem is that the Availability property doesn't return a value at all (nul string) for many devices, depending on the device firmware, driver, etc. Global Const $wbemFlagReturnImmediately = 0x10 Global Const $wbemFlagForwardOnly = 0x20 Global $wbemFlags = $wbemFlagReturnImmediately + $wbemFlagForwardOnly Global $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") Global $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity", "WQL", $wbemFlags) Global $sMsg = "" For $objItem In $colItems $vAvailability = $objItem.Availability $sMsg &= ("Availability: " & $vAvailability & "; " & VarGetType($vAvailability) & @LF) $sMsg &= ("ClassGuid: " & $objItem.ClassGuid & @LF) $sMsg &= ("CreationClassName: " & $objItem.CreationClassName & @LF) $sMsg &= ("Description: " & $objItem.Description & @LF) $sMsg &= ("DeviceID: " & $objItem.DeviceID & @LF) $sMsg &= ("Manufacturer: " & $objItem.Manufacturer & @LF) $sMsg &= ("Name: " & $objItem.Name & @LF) $sMsg &= ("PNPDeviceID: " & $objItem.PNPDeviceID & @LF) $sMsg &= ("SystemName: " & $objItem.SystemName & @LF) $sMsg &= ("----------------------------------------" & @LF) Next MsgBox(64, "Results", $sMsg) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
stamandster 5 Posted January 25, 2011 Gotcha... that's a weird one... hmmm... thanks again PSalty! [size="1"]Windows Updates Finder - Works with XP/2003/Vista/W7/08 and Remotely[/size][size="1"]IniReadSectionEx - Read Large INI Sections[/size][size="1"]Migrate Printers UDF - Like Printer Migration from MS[/size] Share this post Link to post Share on other sites