The following methods can be used to query wmi.
From a DOS prompt, run any of the following:
Pattern: wmic path <wmi class name> get <attribute(s)>
wmic path win32_systemenclosure get *
wmic path win32_systemenclosure get chassistypes
wmic path win32_systemenclosure get chassistypes, model, name, manufacturer
From a DOS prompt:
1. Run 'wbemtest'.
2. Click the 'Connect' button.
3. Change 'root\default' to 'root\cimv2'.
4. Click 'Connect', again.
5. Click the 'Query' button.
6. Enter an appropriate WMI query, i.e., 'select * from win32_processor'.
7. Click the 'Apply' button.
8. A new window opens with one entry per row returned from the above query.
9. Double-click a row. A new window opens that shows the individual attributes for that wmi class in a vertical scrollable format in the 'Properties' section.
10. Scroll down thru the list to find the desired attribute and the value stored in WMI.
Scriptomatic is a free utility provided by Microsoft. It can be download from Microsoft's web site. This utility creates a script, in the selected language, that queries for ALL available attributes of the selected wmi class.
Once the utility is installed, simply run 'scriptomaticV2.hta' to open the GUI. The namespace and class lists will populate and desired entries can be selected. A script will be automatically created within the GUI that queries all available attributes of the selected wmi class. The script can be ran as-is or it can be modified as desired, e.g., by removing unwanted attributes or specifying wmi query criteria. Once the script is ready, it can be ran to generate output in the selected format and corresponding application.
One of the remarkable things about this tool, is that it pre-populates wmi queries in any of four different languages: VBScript, Perl, JScript and Python. Output can be created for any of the following formats: command prompt, text file, HTML, Excel and XML formats.
Note: It may be helpful to edit the .hta file and comment out the following 'If...' and 'End If' lines in the "Sub LoadWMIClasses" subroutine. Commenting out these lines allows a larger set of wmi classes to be seen, i.e., the cim* classes. (Be sure NOT to comment out the 'objClassDictionary...' line.)
' If objQualifierDictionary.Exists("dynamic") Then
objClassDictionary.Add objClass.Path_.Class, ""
Obviously, there are other WMI tools available but these are the major ones normally used by Symantec technical support. And, all of these are FREE!
Rate this Article