1. Home
  2. Computing & Technology
  3. Visual Basic

VBScript - The System Administrator's Language - Part 2

By Dan Mabbutt, About.com

4 of 7

Getting Information From WMI

Using wbemtest

Using wbemtest

The first thing you need to do is find a description of the information you want using a Windows utility so you can code the program. There are a number of different tools that you can use, but once called wbemtest (Remember WBEM from our discussion earlier?) is installed on every version of Windows that hosts WMI -- even though it's not too easy to use. The screenshot shows you what wbemtest looks like and the key controls discussed below.

Here are the steps to do it:

  • Select Start > Run > wbemtest.
  • Click "connect".
  • Change the namespace from "root\default" to the one we want to use - "root\cimv2" - and click "connect" again.
    This should return you to the main form again, but this time the buttons are enabled.
  • Click the "Enum Classes ..." button
  • Select the "Recursive" radio button and click "OK". (You don't have to enter anything in the text box.)
    This huge list is all the classes that you can choose from to retrieve WMI information. That's a LOT of information! Remember, these classes were invented by a standards committee!
  • Pick one and double click on it. This gives you another window with even more confusing information.
    Don't worry ... you can safely ignore much of it. But this is the where you can get the names that you will use later in your script.
  • Click the "Hide System Properties" checkbox to only display the properties that we can use in our script.

Now lets use this information to write our script.

Explore Visual Basic
By Category
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB 6
  5. Learn VBScript
  6. VBScript - The System Administrator's Language - Part 2

©2009 About.com, a part of The New York Times Company.

All rights reserved.