Export (0) Print
Expand All

Creating a Child Namespace with MOF Code

The simplest way of creating a namespace is to use Managed Object Format (MOF) code to create the namespace inside the current directory. The current directory is defined when you log on.

The following procedure describes how to create a child namespace using MOF code.

Aa389746.wedge(en-us,VS.85).gifTo create a child namespace using MOF code

  1. Create an instance of the __Namespace class.

    The following code example shows how to create a child namespace.

    instance of __Namespace 
    {
        Name = "MyNamespace";
    };
    
  2. If you want to require the user to make an encrypted connection to the namespace, use the RequiresEncryption qualifier. For more information, see Requiring an Encrypted Connection to a Namespace.

    The following code example shows how to require an encrypted connection.

    instance of __Namespace 
    {
        Name = "MyNamespace";
        [RequiresEncryption(TRUE)] 
        instance of __MyNamespace { };
    };
    
  3. If you want to set a security descriptor on the namespace rather than using the default namespace security, use the NamespaceSecuritySDDL qualifier. For more information, see Setting Namespace Security When the Namespace is Created.

    The following code example shows how to set a security descriptor on the namespace.

    #pragma namespace("\\\\.\\root\\MyNamespace")
    
    [NamespaceSecuritySDDL ("O:AUG:AUD:(A;CI;0x00060033;;;WD)")]
    Instance of __Namespace
    {
      Name = "MyNamespace";
    };
    
  4. Compile and load the __Namespace instance using the mofcomp utility or the IMofCompiler interface. Both mofcomp and the IMofCompiler interface automatically load the namespace into the current directory. For more information, see Compiling MOF Files.

Related topics

Standard WMI Qualifiers

 

 

Show:
© 2014 Microsoft