Editing SMS_DEF.MOF in SCCM 2007

Editing SMS_DEF.MOF and Configuration.MOF to Report Registry Values

Ok, so vNext is on the horizon and changes how hardware information is inventoried… but for those who still want to customize the SMS_DEF.MOF here is a quick guide to setting up a simple query/report in Configuration Manager using the MOF files.

A couple of things to mention first:

1. Hardware inventorying in SCCM 2012 has changed, no more need for SMS_DEF.MOF. Instead, a wizard will alllow you to directly access WMI and choose the elements you want to inventory. It will be possible to import data from customized MOF files.

2. Upgrading ConfigMgr 2007 with service packs or releases will overwrite any customised MOF files:

If you have customized the default SMS_def.mof hardware inventory reporting file, you must create a backup of this file before upgrading the site. When upgrading a site, customizations made to the existing SMS_def.mof file will be overwritten.

With this in mind off we go…

For example try adding a registry key to a machine during OSD process; i have used a powershell script to write this in as part of the Task Sequence. The script adds a date/time stamp in the registry for reporting purposes. It writes the following key value:

Looking in Resource Explorer from ConfigMgr console we don’t see this information.

To collect the registry key information we have to modify SMS_DEF.MOF and Configuration.MOF. These two files are located in:

%Program Files%\Microsoft Configuration Manager\inboxes\clifiles.src\hinv

Edit both files as follows:

At the end of SMS_DEF.MOF:


//* Class: Custom Registry Key

//* Derived from: (nothing)


//* Created by; Andrew Craig


//* This Registry class queries the registry on clients for the Build Date



[ SMS_Report   (TRUE),

  SMS_Group_Name(“Build Date”),


Class BuildDate : SMS_Class_Template


    [SMS_Report(TRUE),key] string KeyName;

    [SMS_Report(TRUE)]     string BuildDateTime;


And at the end of Configuration.MOF:


Class BuildDate


    [key] string KeyName;

          string BuildDateTime;



instance of BuildDate


    KeyName = “BuildDate”;

    [PropertyContext(“Local|HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\BuildDate|BuildDateTime”), Dynamic, Provider(“RegPropProv”)] BuildDateTime;


From the client, to test, initiate the Machine Policy Retrieval & Evaluation Cycle

Monitor the PolicyAgent.log for successful policy update:


Then initiate the Hardware Inventory Cycle and monitor the InventoryAgent.log for success:


These policies will run according to schedule anyway but for testing purposes we can manually initiate them.

Back to Resource Explorer for the machine and we now see the BuildDate information has been harvested:

Excellent, but we don’t want our reports users having to go into the ConfigMgr console for this information so we will create a Custom Report, linked to Computer Details, and with the following SQL statement:

SELECT SYS.Netbios_Name0, SYS.Resource_Domain_OR_Workgr0,

  OPSYS.Caption0 as C054, OPSYS.Version0,

 MEM.TotalPhysicalMemory0,  IPAddr.IP_Addresses0, Processor.Manufacturer0,

 CSYS.Model0, Processor.Name0, BUILD.BuildDateTime0 

FROM v_R_System SYS

LEFT JOIN  v_RA_System_IPAddresses IPAddr on SYS.ResourceID = IPAddr.ResourceID

LEFT JOIN  v_GS_X86_PC_MEMORY MEM on SYS.ResourceID = MEM.ResourceID


LEFT JOIN  v_GS_PROCESSOR Processor  on Processor.ResourceID = SYS.ResourceID


LEFT JOIN v_GS_Build_Date0 BUILD on SYS.ResourceID=BUILD.ResourceID

WHERE SYS.Netbios_Name0 = @variable

ORDER BY SYS.Netbios_Name0, SYS.Resource_Domain_OR_Workgr0

Our reports users can then browse to the reports URL and run the custom report:

And they can then drill down through the report to see other computer details:

This process can be used to retrieve any registry information from clients for reporting purposes.

You can also, modify these files to return about any inventory information from clients.

Further reading:



4 thoughts on “Editing SMS_DEF.MOF in SCCM 2007

  1. Paul Jensen April 8, 2011 / 10:46 pm

    Nicely done! This will come in handy.

  2. simonerratt@hotmail.com July 20, 2012 / 1:45 am

    Great stuff Andrew. Just one question. In the SQL query, where does the table ‘BUILD’ come from… (BUILD.BuildDateTime0)

    • andrewdcraig July 20, 2012 / 4:54 am

      SCCM creates the v_GS_Build_Date0 table for you. The class is defined in SMS_DEF.MOF to be collected by HINV (hardware inventory cycle). V_GS tables are created automatically by HINV. BUILD is an alias in the SQL for this table.
      If you look at the existing v_gs tables in SQL you will see corresponding tables for inventoried classes.

      So if you created a new class in SMS_DEF called RAM Manufacturer you would also get a table called v_GS_RAM_Manufacturer0.

      Hope this explains it…


  3. simonerratt@hotmail.com July 20, 2012 / 6:46 am

    Yes, of course, I see it now. Thanks.

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 )

Facebook photo

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

Connecting to %s