Custom Inventory Import Error

Profile picture for user PaulW

For those that have used RegKeyToMof to create custom inventory MOF files to inventory registry keys, or export a mof from one environment and import them into another know that it is a fairly easy to do process.  I have now seen on a few occasions now where the MOF file fails to import.  No matter what you do, it will not import.  You receive the following error:

The MOF file you tried to import could not be compiled. Ensure that the MOF file contains valid data.  You can use the command line mofcomp utility to test the data.

MOF Import Summary Error

I have seen this issue come up a few times now and find very little information to troubleshoot it.  You can run mofcomp against the MOF file, as it suggests, and find nothing wrong with the MOF file.  How it initially happens isn't completely known to me either but, here is how we solved it.

So, the easy solution is to rename your Class in RegKeyToMof but, that not always the best solution because, maybe you already have custom reports and scripts that will rely on the class name.  Not to mention, you just want it to be called what you first called it. :-)

The solution involves deleting temp instances of the inventory class from WMI.  We used wbemtest to explore and edit WMI.

  1. From the server, open up an Elevated/Administrator command prompt.  In the elevated prompt, type wbemtest and press enter.
  2. In wbemtest, click Connect.
    Start Wbemtest to edit WMI
  3. Enter root\cimv2\sms\inv_temp for the namespace and click Connect.
    Connect to root\cimv2\sms\inv_temp namespace
  4. Click Enum Classes...
    Click Enum Classes
  5. Leave Superclass name blank and click OK.
    Leave Superclass blank
  6. Delete any classes that do not start with CIM_ or __ (2 underscores).
    Initial WMI Class Instances
  7. When all are deleted, the results should look something like this:
    WMI class instance final results
  8. Exit out of Wbemtest.

Now, go back into the CM console and, in your default client settings, import the class.  You should have no issues.

 

Related Technology

Comments

apparently "Delete any classes that do not start with CIM_ or __ (2 underscores)."

should also include "or SMS"

because you show "SMS_Class_Template" in the results screenshot.

Guess which one I deleted in step 6 since it was absent in the text and even highlighted in the screenshot. ¯\_(ツ)_/¯

Worked well for me. Amazing solution!

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.