Collect custom inventory inside SCCM 2012

Collect custom inventory in SCCM 2012

Collecting custom inventory data has 2 main parts.
First enabling the custom classes using .MOF file then creating a custom SQL report to collect the information from SQL table views.
Enabling custom classes has 2 tasks. 1/ creating an actual configuration.mpf file, 2/ creating a inventory class mof file.

First identify the registry keys what needs to be inventoried and what information we need to capture. Then use RegKeyToMof utility to get the registry keys.

In this example I want to know the SOE version of the each machine from the registry, which is located under HKLM\Software\SOEBuild

First get a copy of RegKeyToMof utility from here
Run the utility and browse to Software\SOEBuild path. Highlight the SOEBuild key to see all the registry keys. Now give a name to ClassGroup and ClassName

On the bottom of the RegKeyToMof tool, you have options to use the version of SCCM you are using and options to change in between configuration.mof and class mof file.

Once you finish selecting the registry keys, if you are happy with the selection, select ConfigMgr12 and choose Configuration.mof. Copy the contents under configuration.mof to a text file and save the taxt file as SOEconfig.mof. Next change the section from configuration.mof to to import in admin/agentsettings/hardwareinventory/setclasses/import tab. Copy the contents from there to a text file and rename the txt file to inventory classes.mof
Now we have SOEConfig.mof and classes.mof file created with the inventory information.
We need to import the new inventory classes into Config Manager by importing the mof files.

First we will import the custom classes to client settings.
Launch SCCM Console then go to Administration, then choose Client Settings. On the right panel choose Default client settings then open properties.

Choose Hardware Inventory then select Set Classes.
This will open Hardware Inventory Classes;

Use Import tab to import newly created .MOF file. Choose Import both hardware inventory classes and hardware inventory class settings then click on import.

 
 Once it completes importing click OK and OK again.

To check whether the import is successful or not Open the Client Settings properties then click on Hardware Inventory on the left side then click on Set Classes.
This will open all the imported or available classes including newly created SOEBuild class

So far we have successfully completed importing hardware classes.

Next we need to add the configuration information to configuration.mof file on site server at %InstallDir%\Microsoft Configuration Manager\inboxes\clifiles.src\hinv
Note: Before you make any changes to the configuration.mof file backup the original file
Open the newly created SOEConfig.mof file using your favourite text editor then use Select All then Copy. Now Open the configuration.mof file with your favourite text editor then select Paste on the bottom of the original configuration.mof then save the configuration.mof

That’s it. The custom classes are imported and inventory is enabled. A new custom table will be enabled in the database to store the information. To view all the available table views in your Config Manager Database create a custom report using this Query.
Now create a SCCM custom report to get the SOEBuild version details.
The custom report query will look like this;
SELECT     v_GS_SYSTEM.Name0 AS [Machine name], v_GS_SOEBuild640.Machinebuilton0 AS [Machine Built On], v_GS_SOEBuild640.Machinebuiltat0 AS [Machine Built at],
v_GS_SOEBuild640.BuildVersion0 AS [Build version]
FROM         v_GS_SOEBuild640 INNER JOIN
v_GS_SYSTEM ON v_GS_SOEBuild640.ResourceID = v_GS_SYSTEM.ResourceID

That’s it. Give enough time to finish the inventory (By default the hardware inventory is set run every 7 days). Then run the report. It will give the Machine name, Machine Built On, Machine Built at and Build Version.
Once the inventory is collected, the final report will look as below;