This is the first part of a series of three articles covering two great WMI tools, introduces how System Center Configuration Manager (SCCM) uses WMI in OS deployment task-sequences.

SCCM task-sequence

Recently I had to use SCCM to deploy a Windows XP image with support for seventeen models. To achieve this aim, a major requirement was to check the target hardware was indeed one of the seventeen models supported before pushing a 6GB image to it.

Briefly, SCCM performs OS deployment by preparing a blank disk, writing an image to the disk and injecting appropriate drivers using a template of commands in sequence. Microsoft cunningly calls this a task-sequence. To provide filtering logic, each step within a task-sequence has an options tab where you can add a WMI query. This allows you to use WMI queries which let you target machines very easily but you need to discover the exact model string for the query to work.

You can find this from the command prompt which a one-line command:

wmic csproduct get name

On a HP desktop this gives “HP Compaq dc7700p Convertible Minitower”.

So that’s the answer, but we need to find the question we have to ask within SCCM to get it. Basic research reveals it to be “SELECT * FROM Win32_ComputerSystem WHERE Model LIKE "%HP Compaq dc7700p%"” (noting the double quotes). So we’re sorted then? Well, not quite. As ever, things are not quite that simple. On HP hardware this works great, but not all machines are equal. On the Lenovo I am writing this article the query gives me the result “name 4334”.

Now more experienced readers will note my deliberate mistake. The correct wmic command to get the machine name is not “name” at all, but “version” as you can see in figure 1. This led me to realise that results vary:

WMI Tools for SCCM - Using wmic to find a machines model name

Using wmic to find a machine’s model name

depending on both the hardware you have, the operating system you need to target and the content of WMI. For example, another surprising quirk of WMI is the Win32_volume class. I wanted to check the free disk space and found a sample using the Win32_volume class, but later found the class is not available on XP.

I needed a tool to let me see three things:

  1. What classes are available
  2. What properties are in each class
  3. What methods are available

I normally use WMI Studio (WMI tools) for writing any vbscripts that use WMI but I wanted to browse classes and write WQL in real-time. I also wanted the tool to be portable. So, I had a rummage around my digital toolbox and found not one but two great tools: Microsoft’s free WMI Code Creator and KS-Soft’s free WMI Explorer are two great complements to easier scripting. I will discuss both tools in my next posts in this series.

1 Comment
  1. Gary 12 years ago

    I do this on a regular basis and have supported up to 25 models. MDT integration makes this a trivial task on XP or 7 using any of the built in variables like Product (which i use). Model is a little trickier (especially with HP). MDT integration also makes WMI easier to use.

Leave a reply

Please enclose code in pre tags

Your email address will not be published.


© 4sysops 2006 - 2023


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account