Jump to content
Sign in to follow this  

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?


#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)

    FileWrite($thisFile, "--------------------------------------" & @CRLF)

Share this post

Link to post
Share on other sites

It is the WMI stuff I guess you need to play around with, and i know of to help you with that

Share this post

Link to post
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

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.