MSFT_UpdatingConsumer class

The MSFT_UpdatingConsumer class is a regular Windows Management Instrumentation (WMI) event consumer that is associated with one or more UPDATE statements that describe the actions to perform for event notification. Optionally, each UPDATE statement can be associated to a single data query.

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

Syntax

class MSFT_UpdatingConsumer : __EventConsumer
{
  string Commands[];
  string DataNamespace;
  string DataQueries[];
  uint32 Flags[];
  string Id;
  string Name;
  string Scenario;
  string UpdateNamespace;
};

Members

The MSFT_UpdatingConsumer class has these types of members:

  • Properties

Properties

The MSFT_UpdatingConsumer class has these properties.

Commands

Data type: string array

Access type: Read/write

Array of UPDATE statements. Each statement executes in order, from the beginning of the array to the end, as if it were an individual MSFT_UpdatingConsumer instance. The effects of a statement are seen by the statements following it. If an error occurs on any statement, the subsequent statements are not executed.

If an INSERT statement is encountered and an element in the Flags array with the same index exists, that flag value is applied to the INSERT statement. If there is no element in the Flags array with the same index, the INSERT statement assumes CreateOrUpdate. Statements other than INSERT ignore the Flags array.

DataNamespace

Data type: string

Access type: Read/write

Option specifying the namespace where the query is performed. This value includes a server name if the query is to be on remote CIM objects. Unless specified in the MachineName property of __EventConsumer, execution of the query process is local.

DataQueries

Data type: string array

Access type: Read/write

Optional array that contains the data resulting from a query. The DataQueries property, in conjunction with DataNamespace, describes part of the context for evaluating the update command and provides data to its corresponding command. For example, if Commands[3] needed some information from Win32_Processor to perform the command, DataQueries[3] would provide that information. The size of this array may be any size that is not greater than the size of the Commands array. An empty string value for any array index specifies that the default "no data query" value should be used. The update command can refer to the properties of the data context using the well-known alias __THISDATA.

Flags

Data type: uint32 array

Access type: Read/write

Array permitting the user to specify additional semantics for INSERT statements. Flags are ignored for DELETE and UPDATE statements.

The flags are directly related to the Commands property by their array index. That is, the flag value for Commands[2] is found at Flags[2]. For example, if Commands[2] is an INSERT command for which you want to specify UpdateOnly, then the value of Flags[2] must be UpdateOnly. Because the default flag value is CreateOrUpdate, you only need to specify a flag if a different value is desired. If the Flags array is shorter than the Commands array, all INSERT commands with an index greater than the highest index in the Flags array assumes CreateOrUpdate.

Flag Meaning
CreateOrUpdate 0 (0x0)

If the object exists, update it; otherwise create it.

UpdateOnly 1 (0x1)

If the object exists, update it; do not create it if it does not exist.

CreateOnly 2 (0x2)

Create the object.

 

Id

Data type: string

Access type: Read/write

Qualifiers: Key

Unique identifier of this consumer.

Name

Data type: string

Access type: Read/write

User-readable name for this consumer.

Scenario

Data type: string

Access type: Read/write

Unique identifier of the scenario with which this consumer is associated. This property allows grouping together of multiple updating consumers that are part of the same scenario.

UpdateNamespace

Data type: string

Access type: Read/write

Namespace where the update is performed. This value includes a server name if the update is to be on remote CIM objects. Unless specified in the MachineName property of __EventConsumer, the update process is executed locally.

Remarks

To execute the updating consumer remotely with respect to where the event processing is done, you must specify a remote computer name for the MachineName property of __EventConsumer. Because the updating consumer is simply an event consumer, this value can be set to allow remote execution.

The process context for a remotely executed updating consumer is the Microsoft Standard COM Surrogate. Because of the way the updating consumer is registered with COM, the surrogate process always runs under the security context of the client invoking it. In most cases, the security context is the system account of the computer on which Windows Management is processing the event. For this to occur, the security context of the event provider must be propagated to the event consumer by setting the MaintainSecurityContext property of the __FilterToConsumerBinding instance to TRUE.

If an MSFT_UpdatingConsumer instance belongs to a scenario (that is, its Scenario property is non-null), and there is no MSFT_UCScenario instance with an Id value that matches the Scenario property, then the consumer only executes a trace event. You can determine that this happened by noting that MSFT_UCExecutedTraceEvent returned a status code of WBEM_S_FALSE.

Note  Because there are two namespaces, \DataNamespace and \UpdateNamespace, you can execute the data or update queries using a particular namespace. Because a namespace can include a server name, the updating consumer is able to query or update remote CIM objects. In such cases, the execution of the updating consumer still occurs locally.

Examples

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.

Requirements

Minimum supported client

Windows XP

Minimum supported server

None supported

End of client support

Windows XP

Namespace

\root\subscription

MOF

Updprov.mof

DLL

Updprov.dll

See also

Using Updating Consumers

Correlation Consumers