pragma autorecover

The pragma autorecover preprocessor command adds a MOF file to the list of files compiled during repository recovery. The list of autorecover MOF files is stored in this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WBEM\CIMOM\autorecover mofs

WMI checks the integrity of the WMI repository when the operating system starts WMI. If the repository is damaged, WMI automatically rebuilds the repository and recompiles any MOF files listed in this key in the registry.

The following describes the syntax for the pragma autorecover command:

#pragma autorecover

However, you must observe the following restrictions when using this command:

  • WMI cannot recover MOF files located on a remote computer.

    Therefore, the MOF files listed in this registry key must reside on the local computer.

  • You cannot specify the command-line switches that the MOF compiler uses when WMI recovers a MOF file.

    Therefore, you should include pragma commands in your MOF file that make command-line switches unnecessary. The following example describes a common command-line switch that WMI does not use when recovering a MOF file from this registry key: mofcomp -N:Root\Test mymof.mof

    However, you can specify the namespace using a pragma command in the MOF file.

    #pragma namespace ("\\\\.\\Root\\test")
    

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008

See also

Preprocessor Commands