Parsing error in a custom MOF file during extending the Hardware Inventory Classes

February 8, 2016 at 1:42 pm in Uncategorized by filip

Hello All,

At the moment I’m implementing SCCM 2012 SP2 for a customer.

They have a specific requirement for creating collections based on registry keys and values.

This can be done by extending the Hardware Classes for the Hardware Inventory process.

There are already several good blogs which can be followed to achieve this (such as: and I had implemented this already several times.

Only this time, I saw some errors when importing the configuration.mof file:


It seemed something was wrong with my syntax.

The RegKeyToMof.exe had always compiled perfect code to paste into the MOF file.
What could be wrong with it now?

There is a utility which can be used to verify the integrity of MOF files: mofcomp.exe.
This executable comes with a parameter that will check your mof and show if errors occur: -Check

When running the mofcomp.exe with the check parameter, I got the following (more detailed) error message:


It seemed as if an opening brace is missing at line 275; let’s go ahead and check that line:


The registry key we are trying to import is called M@gStation.
The ‘@’ in the name is fooling the interpreter that this isn’t just the classname, but the definition of a new class.
The RegKeyToMof.exe takes over the name of the registry key as the classname.
In most cases this isn’t an issue, unless it contains special characters.. D’OH!

After renaming the ‘@’ to ‘a’, no more errors were noticed and the integrity of the mof file was confirmed:

First using the mofcomp.exe:

Secondly after having placed the configuration.mof in the appropriate inbox

Hope this helps someone out there J