Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
pragma namespace

pragma namespace

The pragma namespace preprocessor command requests that the compiler load the MOF file into the namespace specified as namespacepath. If both the MOF compiler -n namespace switch and the #pragma namespace namespacepath command are used, the command takes priority over the switch.

The following describes the syntax:

#pragma namespace ("[Namespace]")

[Namespace] is the specified namespace.

If you do not specify this command or the equivalent command-line switch, the MOF compiler uses the root\default namespace by default.


You can require that client scripts and applications use an encrypted connection for authentication by adding the RequiresEncryption qualifier to the .mof file that creates the namespace. You can also modify an existing namespace by adding this attribute and compile the MOF file again. For more information about how to use RequiresEncryption, see Requiring an Encrypted Connection to a Namespace.

Windows Server 2003:  Before Windows Server 2003 with Service Pack 1 (SP1), providers could not set namespace security to require encryption before returning data.


The following example shows how place classes or instances in the root\test namespace.

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


Minimum supported client

Windows Vista

Minimum supported server

Windows Server 2003

See also

Setting Namepace Security Descriptors
Standard WMI Qualifiers
Preprocessor Commands



© 2015 Microsoft