MSDN Library

MSFT_TemplateBuilder class

The MSFT_TemplateBuilder class specifies a low-level object that is created when the user creates an instance of a template object. An instance of a template builder is created for each low-level object needed by the template class.

Note  For more information about support and installation of this component on a specific operating system, see Operating System Availability of WMI Components.


class MSFT_TemplateBuilder
  string ControllingProperty;
  string Name;
  string NamespaceProperty;
  sint32 Order = 0;
  object Target;
  string Template;


The MSFT_TemplateBuilder class has these types of members:


The MSFT_TemplateBuilder class has these properties.

Data type: string
Access type: Read/write

Option that makes the creation of a template builder object dependent on a template property value. If specified, the template provider observes, when the template object is created, the template argument named by the property. If the value of this property is NULL or if the property is a Boolean type and its value is FALSE, the builder is not be instantiated.

Data type: string
Access type: Read/write
Qualifiers: Key

Unique identifier of this template builder.

Data type: string
Access type: Read/write

Option that represents a property on the template object. When the object is created, the value of this property specifies the namespace in which the target is created.

Data type: sint32
Access type: Read/write

Option specifying the order in which this object is instantiated by the template provider. The Order value is an integer that specifies all builder objects that have an order X are instantiated before builder objects having an order Y, where X < Y. If no order is specified, then it is defaulted to 0 (zero).

Data type: object
Access type: Read/write
Qualifiers: Not_Null

An embedded object that is instantiated by a Provider::PutInstance call with Target as an argument. For more information, see the Remarks section of this topic.

Data type: string
Access type: Read/write
Qualifiers: Key

Identifier of the template class for which this template builder is specified.


If the instance to be created by the builder is not parameterized by any template arguments, the Target property is a simple embedded object, as in the following example.

Instance of MSFT_TemplateBuilder
  Name = "ExampleBuilder";
  Template = "CorrelationTemplate";
  Target = instance of __EventFilter 
    Query = "SELECT * FROM __InstanceModificationEvent "
            "WHERE TargetInstance ISA 'MyClass'";

In most cases, however, the values in the object to be created are parameterized by the values in the template. For instance, in the above example, the Template Creator might want to register a filter for events of the type specified in the WatchClass property of the template. Three instance-level property qualifiers are available to allow parameterization of objects.

Note  Any user with partial write privileges in a namespace can modify a template definition. Even though the user does not have the permissions needed to instantiate the template, if the template is instantiated by an administrator, the template creates objects using administrator permissions.


For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.


Minimum supported client

Windows XP

Minimum supported server

None supported

End of client support

Windows XP







See also

Correlation Consumers



© 2015 Microsoft