The real issue is to test our WMI queries. Windows provides a tool to provide just for this. This tool is called WBEMTEST. You can start this by typing WBEMTEST on run box in start menu.
As soon as you press OK, following form is shown on the screen:
Since WMI objects are defined in various namespaces, you would need to connect to the required namespace before querying any specified WMI object. Select "Connect" and enter namespace information on the following form:
As you can see, we have selected CIMV2 which have required WMI objects we would be accessing shortly. When you select namespace, it is selected on the main form as follows:
Since we are connected to the required namespace, we can write queries for any object in this namespace. As you might know, the names of WMI objects traditionally start from "win32_". Here we are accessing information from WIN32_COMPUTERSYSTEM object.
We have written following WQL query:
Select * from win32_ComputerSystem
If you provide a valid WMI object then the result gets loaded. Otherwise, it results in weird exception messages.
You can view the properties of the object by double clicking the query result item. In our case, the properties are as follows:
In this way, we can select the properties of any WMI object.
No comments:
Post a Comment