MOF Compiler

[This is preliminary documentation and subject to change.]

The Managed Object Format (MOF) compiler parses a file containing MOF statements and adds the classes and instances defined in the file to the CIMOM repository.

mofcomp
    [-check]
    [-N: <namespace path>]
    [-class:updateonly | -class:createonly] 
    [-instance:updateonly | -instance:createonly]
    [-B:<filename>]
    [-WMI]
    [-P:<Password>]
    [-U:<UserName>]
    [-A:<Authority>]
    [-L:<FLAGS>]
    <MOF file>
 

Switches

-check
Requests that the compiler perform a syntax check only and print appropriate error messages. No other switch can be used with this switch. No connection to CIMOM is established and no modifications to the repository are made.
-N
Requests that the compiler load the MOF file into the specified namespace. The default namespace (Root\Default) is used unless this switch is used or a #pragma namespace ("namespace path") statement appears in the MOF file.
-class:updateonly
Requests that the compiler not create any new classes, terminating if a class specified in the MOF file does not exist.
-class:createonly
Requests that the compiler not make any changes to existing classes, terminating if a class specified in the MOF file already exists.
-instance:updateonly
Requests that the compiler not create any new instances, terminating if an instance specified in the MOF file does not exist.
-instance:createonly
Requests that the compiler not make any changes to existing instances, terminating if an instance specified in the MOF file already exists.
-B
Requests that the compiler create a binary version of the MOF file without making any modifications to the repository. The binary MOF file is created with the BMOF extension.
-WMI
Requests that the compiler perform a WMI syntax check. The -B switch must be used with this switch.
-P
Specifies a password to use when logging on.
-U
Specifies the name of the user logging on.
-A
Specifies the authority (domain name) to use when logging on.
-L
Specifies the type of authentication to use when logging on. The following values are valid:
Authentication value Description
0 Default authentication
1 Windows NT LAN Manager (NTLM) authentication
2 WBEM authentication

For a thorough description of the authentication schemes supported by WBEM, see WBEM Security.

Return Values

As its first operation, the MOF compiler performs a syntax check on the MOF file. If it finds any errors, an error message is printed and the process terminates. The following values can be returned:

Return value Description
0 MOF compilation was successful.
1 MOF compiler could not connect with the CIMOM server possibly due to a semantic error such as an incompatibility with the existing repository or an actual error such as the failure of the CIMOM server to start.
2 One or more command line switches were invalid.
3 MOF syntax error.

Remarks

A file can be compiled with the following simple command line entries:

mofcomp <MOF filename>

When special processing is required, one or more of the switches can be used. All of the switches are optional, and any combination is allowed. However, it does not make sense to use some of the switches in combination with others. For example, to combine the -class:updateonly and -class:createonly switches results in the compiler not performing any action.

A MOF file that is using the Unicode character set contains a signature as the first two bytes of the file. This signature is either U+FFFE or U+FEFF, depending on the byte ordering of the file.

When there are no errors in the parsing process, the MOF compiler connects to the CIMOM server running on the local machine unless the -check switch is specified. Classes and instances defined in the MOF file are added to the repository.

When there is an error in updating the repository, no attempt is made to bring it back to the state it was in before the compiler began processing.

For information about how to declare classes and instances using the MOF syntax, see Using the Managed Object Format (MOF) Language.