Extending SMS Hardware Inventory

Doing a demo, I came upon a task to extend the built-in hardware inventory of SMS 2003. I was using SMS 2003 SP2. The two tasks were:

  • collect information about extended physical hardware - e.g. banks of physical memory
  • collect information about asset numbers of custom applications installed on computers

The first one was easier. It does not need recompilation of the sms_def.mof file on SMS agents. All you need to do is add this to the sms_def.mof in SMS\inboxes\clifiles.src\hinv folder:

[ SMS_Report (TRUE), SMS_Group_Name ("Custom Inventory - Physical Memory"), SMS_Class_ID ("MICROSOFT|PHYSICAL_MEMORY|1.0") ]

class Win32_Physicalmemory : SMS_Class_Template
[SMS_Report (TRUE) ] string BankLabel;
[SMS_Report (TRUE) ] uint64 Capacity;
[SMS_Report (TRUE) ] string DeviceLocator;
[SMS_Report (TRUE) ] uint16 FormFactor;
[SMS_Report (TRUE), key ] uint16 MemoryType;
[SMS_Report (TRUE) ] uint32 PositionInRow;

And then initiate HW inventory or wait for it to finish. Resource Explorer will show the new branch  called "Custom Inventory - Physical Memory".


The second task I approached with assumption that registry is the store for the asset information (could as well be a file).

1. Add the following lines to sms_def.mof:

#pragma namespace("\\\\.\\root\\cimV2")

class CustomClassName
[key] string KeyName=""
string AssetNo;
string AssetName;

instance of CustomClassName
[PropertyContext("local|HKEY_LOCAL_MACHINE\\Software\\CustomClassName|Asset No"),
Dynamic, Provider("RegPropProv")] AssetNo;
Dynamic, Provider("RegPropProv")] AssetName;

#pragma namespace("\\\\.\\root\\CIMV2\\SMS")

SMS_Group_Name("CustomClassName- Asset Numbers"),
class CustomClassName: SMS_Class_Template
string AssetNo;
string AssetName;

2. Add the registry keys as according to the above definition on the agents.

3. Recomplie the whole new sms_def.mof file on clients (by distributing a new package with this command: "mofcomp sms_def.mof") - this is needed in that case, since we are extending the original WMI scope for the agents

4. Initiate or wait for HW inventory

5. Resource Explorer will show the new branch "CustomClassName"

Last small tip is that you can use the log file mofcomp.log in %windows%\system32\wbem\logs on the SMS Server to see whether the MOF file compilation succeeded.