stamandster Posted January 24, 2011 Share 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 25, 2011 Share 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 Link to comment Share on other sites More sharing options...
stamandster Posted January 25, 2011 Author Share Posted January 25, 2011 Gotcha... that's a weird one... hmmm... thanks again PSalty! 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