Share via


How to capture and report on a registry setting from Configuration Manager clients

https://blogs.technet.com/configurationmgr/archive/2009/05/11/how-to-capture-and-report-on-a-registry-setting-from-configuration-manager-clients.aspx 

This article seeks to offer a more complete solution on not only how to capture various registry settings from a client into the System Center Configuration Manager 2007 database, but to also demo how to build a sample query to report on those settings.

This sample will use a fictitious Software Application name for example purposes: "SampleAppOne"

With the following Registry Settings as an example:

[HKEY_LOCAL_MACHINE\SOFTWARE\SampleAppOne]
"Description"="Sample Application One Description"
"DisplayName"="Sample Application One"
"Enable"=dword:00000001

First import the above registry settings into your test client.

Next, make backup copies of the following files before making the changes outlined below:

X:\Program Files\Microsoft Configuration Manager\Inboxes\clifiles.src\hinv\sms_def.mof
X:\Program Files\Microsoft Configuration Manager\Inboxes\clifiles.src\hinv\configuration.mof

Where X:\ is the drive where Configuration Manager 2007 is installed.

The following settings were configured at the end of the sms_def.mof

#pragma namespace ("\\\\.\\root\\cimv2\\SMS")
#pragma deleteclass("SampleAppOne", NOFAIL)
[SMS_Report(TRUE),
SMS_Group_Name("SampleAppOne"),
SMS_Class_ID("Custom|SamepleAppOne|1.0")]
Class SamepleAppOne : SMS_Class_Template
{
  [SMS_Report(TRUE),key] string KeyName;
  [SMS_Report(TRUE)] String Description;
  [SMS_Report(TRUE)] String DisplayName;
  [SMS_Report(TRUE)] Uint32 Enable;};

The following settings were configured at the end of the configuration.mof

#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass("SampleAppOne", NOFAIL)

[DYNPROPS]
Class SampleAppOne
{
  [key] string KeyName;
          String Description;
          string DisplayName;
          Uint32 Enable;
};
[DYNPROPS]
Instance of SampleAppOne
{keyname="SampleAppOne";
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\SampleAppOne|Description"),
Dynamic, Provider("RegPropProv")] Description;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\SampleAppOne|DisplayName"),
Dynamic, Provider("RegPropProv")] DisplayName;
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\SampleAppOne|Enable"),
Dynamic, Provider("RegPropProv")] Enable;
};

Once you have backed up and made the changes outlined above, Run mofcomp.exe on both the sms_def.mof and configuration.mof as follows:

%WINDIR%\System32\WBEM\Mofcomp.exe "X:\Program Files\Microsoft Configuration Manager\Inboxes\clifiles.src\hinv\sms_def.mof"
%WINDIR%\System32\WBEM\Mofcomp.exe "X:\Program Files\Microsoft Configuration Manager\Inboxes\clifiles.src\hinv\configuration.mof"

Where X:\ is the drive where Configuration Manager 2007 is installed.

Next we need to force Hardware Inventory up from a client to test and/or wait until the next scheduled Hardware Inventory is run. The changes made to the mof files on the server should start collecting the information from the client’s registry during the next Hardware Inventory Cycle.

In my testing, once the database was updated with the new tables from the custom Hardware Inventory (db0.SampleAppOne_data, history, etc...) I had to restart the SCCM 2007 Server for the mof changes to show up in the New Query as a selectable attribute. Once the tables start showing up in the SMS_Database, then restart the SCCM Server, and proceed to the next steps.

Now you can run a query from ConfigMgr 2007 Console to get a basic report showing Computer name, and a value from one of the registry keys for this computer as follows:

select SMS_R_System.Name, SMS_G_System_CUSTOM_SAMPLEAPPONE_1_0.Enable from  SMS_R_System inner join SMS_G_System_CUSTOM_SAMPLEAPPONE_1_0 on SMS_G_System_CUSTOM_SAMPLEAPPONE_1_0.ResourceId = SMS_R_System.ResourceId where SMS_G_System_CUSTOM_SAMPLEAPPONE_1_0.Enable = 1

This should return the computer names of any clients that have the registry setting Enable with a value = 1.

 

x