Jump to content

Need some clarification


Recommended Posts

OK, I know that this has been asked and answered here, but just can't seem to find it.

What I need to understand better is what the ObjGet returns and how to use it.

Code below was taken from here, but would like to know what all can be gleened from it. I see the Caption and DeviceId stuff, but what else is available? If I were to use this with another ObjGet call to another area, how would I know what I can see/get?

Or is it the query/WMIService area that needs to be asked about?

See my somewhat naive and noob confusion?

Thanks

#include <File.au3>
$strComputer = "."
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity where DeviceID like 'USB\\%'")

If IsObj($colItems) then
    $thisFile = FileOpen("usbstuff.txt", 2)
    For $objItem In $colItems
        FileWrite($thisFile, "--------------------------------------" & @CRLF)
        FileWrite($thisFile, "Caption: " & $objItem.Caption & @CRLF)
        FileWrite($thisFile, "DeviceId: " & $objItem.DeviceID & @CRLF)

Next
    FileWrite($thisFile, "--------------------------------------" & @CRLF)
    FileClose($thisFile)
Endif
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...