Jump to content
Sign in to follow this  
destro

WMI Query

Recommended Posts

destro

Hi,

I have looked through the forum and not come across a solution to this particular issue that I am having.

I am trying to get all of the information possible from certain areas of the WMI.

My idea was to have some code like this:

$objWMI = ObjGet("winmgmts:\\localhost\root\CIMV2")
$objItems = $objWMI.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", 0x10 + 0x20)

If IsObj($objItems) Then
    For $objItem In $objItems
        ConsoleWrite("Manufacturer: " & $objItem.Manufacturer & @CRLF)
        ConsoleWrite("Model: " & $objItem.Model & @CRLF)
        ConsoleWrite("Name: " & $objItem.Caption & @CRLF)
        ConsoleWrite("Description: " & $objItem.Description & @CRLF)
    Next
EndIf

The problem I have is that I don't want to have to know the name of every value that I want to query. I just want to get ALL the values that are in the class.

For example, in the above Ihave used $objItem.Manufacturer, $objItem.Model, $objItem.Caption and $objItem.Description. The problem is that I don't always know what is in there so I just want to dump ALL of the values without having to look up each one individually.

Is this possible?

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  

×