SCCM Query to Find Registry Key Value That is IP Address

I am try to create a collection that will show all computers with the following registry value:

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\SNMP\Parameters\TrapConfiguration\mesnet]
"1"="10.213.11.221"

Does anyone know how to create the query?  Ive already updated the mof files on SCCM.  Thanks.

September 24th, 2012 11:46pm

Has the data being collected by CM07 yet? Are you looking for a Query or a Report? i.e. What are you going to do this this query? Use it for a collecting or report?

Keep mind that that no one here can directly help you since this is an custom sms_def.mof, and no one here know what exactly you added to both the sms_def.mof and configutaiton.mof. Without these piece of information everyone is just guess.

    • Determine if CM07 has indeed collected the data, there is no point in moving forward without knowing this.
    • Do you want a collection or a Report?
    • Based on the above details,
      1. use SQL Management studio to determine what the view name is for a Report
      2. Use query builder to create a query, for use with your collection.

There are no official primers for report / query writing for CM07. However within the CM07 course 6451, there is a module on both Queries and Reports. If I remember it is module 5.

Free Windows Admin Tool Kit Click here and download it now
September 25th, 2012 1:07am

Side point here also: ControlSet001 may be an old set of data and may not correspond to what's actually configured on the system If you need to query something in the SYSTEM hive, you should use CurrentControlSet (which is transparently directed to whichever ControlSet is active on a system). 

September 25th, 2012 3:39am

This is what I entered in the Config.mof file:

// RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
// this section tells the inventory agent what to collect
// 9/25/2012 9:20:39 AM

#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass("mesnet", NOFAIL)
[DYNPROPS]
Class mesnet
{
[key] string KeyName;
String 1;
};

[DYNPROPS]
Instance of mesnet
{
KeyName="RegKeyToMOF_32";
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\services\\SNMP\\Parameters\\TrapConfiguration\\mesnet|1"),Dynamic,Provider("RegPropProv")] 1;
};

#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass("mesnet_64", NOFAIL)
[DYNPROPS]
Class mesnet_64
{
[key] string KeyName;
String 1;
};

[DYNPROPS]
Instance of mesnet_64
{
KeyName="RegKeyToMOF_64";
[PropertyContext("Local|HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\services\\SNMP\\Parameters\\TrapConfiguration\\mesnet|1"),Dynamic,Provider("RegPropProv")] 1;
};

This is what I added to the sms_def.mof file:

// RegKeyToMOF by Mark Cochrane (thanks to Skissinger, Steverac, Jonas Hettich & Kent Agerlund)
// this section tells the inventory agent what to report to the server
// 9/25/2012 9:20:39 AM

#pragma namespace ("\\\\.\\root\\cimv2\\SMS")
#pragma deleteclass("mesnet", NOFAIL)
[SMS_Report(TRUE),SMS_Group_Name("mesnet"),SMS_Class_ID("Custom|mesnet|1.0"),
SMS_Context_1("__ProviderArchitecture=32|uint32"),
SMS_Context_2("__RequiredArchitecture=true|boolean")]
Class mesnet: SMS_Class_Template
{
[SMS_Report(TRUE),key] string KeyName;
[SMS_Report(TRUE)] String 1;
};

#pragma namespace ("\\\\.\\root\\cimv2\\SMS")
#pragma deleteclass("mesnet_64", NOFAIL)
[SMS_Report(TRUE),SMS_Group_Name("mesnet"),SMS_Class_ID("Custom|mesnet|1.0"),
SMS_Context_1("__ProviderArchitecture=64|uint32"),
SMS_Context_2("__RequiredArchitecture=true|boolean")]
Class mesnet_64 : SMS_Class_Template
{
[SMS_Report(TRUE),key] string KeyName;
[SMS_Report(TRUE)] String 1;
};

I'd like to gather a report on computers that do not have this setting.  Once I identify those computers that need this config, i plan on pushing out a package so that they are properly configured. 

Free Windows Admin Tool Kit Click here and download it now
September 25th, 2012 5:23pm

So did you fix this MOF edit to collect the current data vs the historical data, like Jason pointed out? I assume that you don't care about the historical data.

Have you confirmed that the data is being collected?

Did you figure out what the view name was called.. BTW it should be something like v_GS_mesnet

October 4th, 2012 5:54pm

Hi,

As this thread has been quiet for a while, we assume that the issue has been resolved. At this time, we will mark it as "Answered" as the previous steps should be helpful for many similar scenarios.

In addition, wed love to hear your feedback about the solution. By sharing your experience you can help other community members facing similar problems.

Thanks,

Free Windows Admin Tool Kit Click here and download it now
October 9th, 2012 9:10am

Actually we've been busy with the Win7 rollout in general so I have not had a chance to try out the suggestions here, but I will and let eveyone know what happened. 
December 14th, 2012 7:23pm

Actually, it is quite frustrating to search the internet and find that the same question I am looking to have answered has been asked only to find that no one actually answered the question. How do you query in SCCM for a particular value of a particular registry key? I may be missing something but I don't see a single answer that has anything to do with a query. If someone has that answer and posts it here I would find it super helpful indeed.
  • Edited by MrEMeat Friday, March 15, 2013 2:04 PM
Free Windows Admin Tool Kit Click here and download it now
March 15th, 2013 2:02pm

Actually, it is quite frustrating to search the internet and find that the same question I am looking to have answered has been asked only to find that no one actually answered the question. How do you query in SCCM for a particular value of a particular registry key? I may be missing something but I don't see a single answer that has anything to do with a query. If someone has that answer and posts it here I would find it super helpful indeed.
  • Edited by MrEMeat Friday, March 15, 2013 2:04 PM
March 15th, 2013 2:02pm

Actually, it is quite frustrating to search the internet and find that the same question I am looking to have answered has been asked only to find that no one actually answered the question. How do you query in SCCM for a particular value of a particular registry key? I may be missing something but I don't see a single answer that has anything to do with a query. If someone has that answer and posts it here I would find it super helpful indeed.
  • Edited by MrEMeat Friday, March 15, 2013 2:04 PM
Free Windows Admin Tool Kit Click here and download it now
March 15th, 2013 5:02pm

Actually, it is quite frustrating to search the internet and find that the same question I am looking to have answered has been asked only to find that no one actually answered the question. How do you query in SCCM for a particular value of a particular registry key? I may be missing something but I don't see a single answer that has anything to do with a query. If someone has that answer and posts it here I would find it super helpful indeed.

CM07 know nothing about registry keys, therefore you must extend CM07 to collection this data.

The question is do you need to inventor the data or know it compliance state?

For inventory:

You do this by edit your sms_def.mof / configruaiton.mof. Once you extend the sms_def.mof / configruaiton.mof, your clients will start reporting this data to your CM07 site.

The easiest way to create the mof edits you need is to use a program called RegKeyToMOF, then you append those edit to the appropriate file.

For compliance state:

You write a Desire Configuration Manager (SCM) Rule. This can take many forms depending on what you want to do.

March 15th, 2013 5:27pm

I know this is an old thread, but I figure it's never too old to add a solution.

This one was driving me nuts, as every thread I could find on the topic of making a query based on a registry key only had the info above, relating to extending the mof's. Just like above the actual question never gets answered as to how to make the query after the .mof files are appended.

I ended up following the directions on the linked page, note the section at the end-

"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"

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

I can see why this isn't well documented though as the amount of work to extend the mof files, get them to work properly as part of the inventory, and to get a query working (and then to have it limited by inventory timing) probably takes so much time and effort that better solutions can be found for most of this methods uses.

Free Windows Admin Tool Kit Click here and download it now
February 24th, 2015 12:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics