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”)

[DYNPROPS]
class CustomClassName
{
[key] string KeyName=””
string AssetNo;
string AssetName;
};

[DYNPROPS]
instance of CustomClassName
{
KeyName=”CustomClassName”
[PropertyContext(“local|HKEY_LOCAL_MACHINE\\Software\\CustomClassName|Asset No”),
Dynamic, Provider(“RegPropProv”)] AssetNo;
[PropertyContext(“local|HKEY_LOCAL_MACHINE\\Software\\CustomClassName|AssetName”),
Dynamic, Provider(“RegPropProv”)] AssetName;
};

#pragma namespace(“\\\\.\\root\\CIMV2\\SMS”)

[SMS_Report(TRUE),
SMS_Group_Name(“CustomClassName- Asset Numbers”),
SMS_Class_ID(“MICROSOFT|CustomClassName|1.0”)]
class CustomClassName: SMS_Class_Template
{
[SMS_Report(TRUE),key]
string AssetNo;
[SMS_Report(TRUE)]
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.

Advertisements

~ by alipka on December 14, 2006.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: