How to Use RegKeyToMof

by | Oct 26, 2022 | ConfigMgr, How-To

Last updated on January 10th, 2023 at 09:04 am

For two upcoming articles, I wanted to leverage my existing RegKeyToMof article and add a video (at the end) to it to show How to Use RegKeyToMof. Then I noticed that I had two articles on the subject. This articles that the best of those two posts and combines them into this one.

Several years ago, I received an email from a client asking for help with the RegKeyToMof tool. They asked, “Do you know the process for using RegKeyToMof.exe and how to append the configuration.mof and/or importing MOFs? This might be a tremendous help because I haven’t seen a definitive guide.” This question is still one that I hear today in 2022, so I thought that I would update my original blog post and show you how to use RegKeyToMof.

What Is RegKeyToMof?

RegKeyToMof is a useful tool for any Microsoft Configuration Manager ( MEMCM / MECM / SCCM / ConfigMgr / MCM ) administrator. This tool allows you to inventory registry keys on a device and return the data back to SCCM via hardware inventory. From this point you can do whatever you want to the data: create reports, create collections, import the results into ServiceNow, etc.

How To Use RegKeyToMof

The following step-by-step instructions are from my original post and are for SCCM, but still apply for ConfigMgr Current Branch.

For this example, I will assume that you are looking for static keys under:

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Terminal Server\RCM

Note: The video is looking for different key. I inventoried registry key for CVE-2021-26414. For more details about the CVE, please see the Microsoft KB5004442 on the subject.

Where download RegKeyToMof

You can download the latest version for the Twin City User Group site.

Step-By-Step Instructions

First, browse to the registry key in the upper left window.

Broswing the Registry with RegKeyToMof

You will notice that as you make changes in the various text boxes, the configuration.mof text will also change. Really, that’s all there is to the tool. It creates the mof edits that you require and now all you have to do is append / import these edits to the appropriate files.

Next, change the ClassGroup and ClassName. This is an optional step, but I recommend doing this so that you can ensure that the mof edit is unique. In the examples above and below you can see that I changed ClassGroup from Custom to Enhansoft and ClassName from RCM to ES_RCM.

As you make changes in the various text boxes you’ll see that the configuration.mof text will also change. Really, that’s all that there is to this tool. It creates the mof edits (so you don’t have too) that you require to Inventory the Reg keys. Now all you have to do is append/import these edits to the appropriate files.

That is it, now that you have everything that you need to inventory the reg keys. Let’s add the details to ConfigMgr.

Appending Text To The Mof File

Let’s start with appending the text to the configuration.mof file.


Copy text to Configuration.mof

Tip: I also recommend that you back-up your configuration.mof file before making any edit to it.

Open your configuration.mof file located here, <CM install directory>\inboxes\clifiles.src\hinv, and scroll to the bottom of the configuration.mof file. Next, append all of the text within the configuration.mof tab in RegKeyToMof. Save the file and you are done with this section.

Importing the Client Setting


MOR setting for CM console import

Copy the agent setting mof text from the, to import in Admin/…, tab in RegKeyToMof, into a text file. I have called the one in my example, RCM.mof.

Go to the Client Agent setting section in the SCCM console, and click Set Classes…


Import Client settings mof

Click on the Import… button.


Oprn Mof file

Select the RCM.mof file and then click on the Open button.

Click on the Import button.
RegKeyToMof Import_Summary

Click on the Import button.

CM12 Console setttings

Notice that the two classes are imported and then click OK.

Lastly, wait for the clients to start reporting inventory. This will take up to twice the usual hardware inventory cycle before the newly inventoried regkeys show up.

How to Use RegKeyToMof Video

Over the coming weeks, you will see two new articles on determine the increase to the database size for Custom Inventory. Also, you will see a article on how to clean up unwanted Custom Inventory too.

What else would you like to know about ConfigMgr Custom Inventory? Since I will be putting out a lot more videos on YouTube. Don’t forget to subscribe and click the like button. I will help bring the videos to admins like you.

Finally, don’t forget that you can subscribe to my RRS feed to stay on top of the latest trips and tricks. Additionally, If you have any questions, please feel free to touch base @Garthmj.