Partager via


WBEMTEST..., your easiest gateway into WMI

If you spend much time around Configuration Manager you become aware that a lot of it runs through WMI.  WMI is “Windows Management Instrumentation” and is essentially Microsoft’s implementation of a internet standard called Web Based Enterprise Management (WBEM).

If you are doing task sequences and wanting to provide intelligent branching, digging into hardware inventory to possibly extend it, or working with the ConfigMgr SDK, you are playing around with WMI/WBEM.  One tool I like to show my users who are new to WMI is one which is built right into every windows OS, called WBEMTEST.  As you read this blog feel free to follow along, as I’m betting most readers are on a windows box.  Go to Start and type “WBEMTEST” into the search or run box.

Before I get too far, let me note that there are many WMI tools out there.  On a regular basis I don’t use any of them?  Why?  Many are more friendly with a better UI designed.  The big downside is that they have to be downloaded every time you want to use them.  WBEMtest is at your fingers on any windows machine and OS learning to use it will speed your troubleshooting compared to going in search of your other favorite WMI tool.

When you launch WBEMTEST different OS will work slightly differently.  Some will automatically connect to a namespace, others (like Win7) will not.  If you aren’t connected you can hit the connect button, make sure “root\cimv2” is selected, then hit connect again.  Now you are back in the main UI with everything “lit up” and ready to go.  A namespace is, to relate it to something most folks are familiar with, a directory within WMI.  You can change directories to all kinds of namespaces.  CIMV2 is where a good amount of hardware information is kept.

image

From here you have lots of options.  If you are already a WMI expert and know hat you are after you could hit the query button and type your WMI query to look at the results.  For the beginner, just exploring WMI for the first time, I suggest you hit the “Enum Classes” button.  In the pop-up choose “Recursive” and hit OK.  You have just done the equivalent of a DIR to list all the contents of the name space.  Everything with underscores (__) in the front of the name is what I call WMI overhead.  This is what helps WMI be WMI.  IN most cases you will skip over that and look at the other stuff.  For this discussion I suggest going to Win32_Service and double clicking.

You have now opened up this “file” in WMI which lists all the collect info about services on your machine.  The file/directory analogy starts to break down at this point.  Know that this is some definition information and skip past it by clicking on the instances button.  You now get a list of all the services on your machine.  Pick a service, such as RemoteRegistry” and double click it.  You now get to see all the info about that specific service.  This view is kind of a pain to look at, however, so I recommend you click the “Show MOF” button to get a nicer view of it all.  Here you can see the service state, description, start mode, etc.

Snoop around in WMI and see what you can find.  Know that once you find something you could write queries in your task sequence to use that data as decision points, you could collect it via hardware inventory, or you could script against it using the SDK.  All kinds of things open up for you.  A few other namespaces you might be interested in are

Have fun exploring!