All Forums >> [Scripting] >> Post a VBScript >> WMI Cimv2 Classes and their Values - HTA Browser Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Posts: 2359
Score: 36
Joined: 6/29/2006
From: Orange County, California
Status: offline
The following code is for an HTA that will dynamically list all the available classes under the cimv2 namespace. It will query the local machine initially, but you can specify a remote machine and alternate credentials should you require it. You will notice a lot of the same functions/subs as my "scripts currently running" (http://www.visualbasicscript.com/m_41962/tm.htm) or Win32_Ping (http://www.visualbasicscript.com/m_42535/tm.htm) posts.
Though you can retrieve a lot of this information using wbemtest or ms' WMI object browser or generate WMI queries using WMI Code creator or Scriptomatic, this HTA is intended to quickly and easily let you select a class name (without having to look it up) and see only those properties that contain data immediately. The filter text field lets you filter down your results. Simply put in what you would normally specify in a "where" clause. For example, if looking at the Win32_NetworkAdapterConfiguration, a valid filter would be: ipenabled=true . For the Win32_PingStatus, a valid filter would be ipaddress='www.yahoo.com' or ipaddress='www.yahoo.com' and timeout=2000 .
Rather than display the methods for each class, I decided to turn the class name displayed into a link to Microsoft MSDN so that you can look up the documentation for yourself and see what methods are available and how to use them.
This version was tested on a WinXP/2k3 box. There is a function to convert UTC time to regular time so all date/times will appear in their standard form; just so you're not surprised why it looks that way with this HTA and different when you create your own query. A .NET array is used to sort the available classes in alphabetical order and IE object is created for a progress type window.
Becareful when selecting classes that contain a large amount of data. CIM_Datafile, Win32_NTEventLog, etc. without using some filtering.
Well enough with that, here's the code. If anything, this can serve as an example to the functions used to create this.
Version 2 (allows for more specific queries)
< Message edited by dm_4ever -- 3/3/2007 2:48:53 AM >