In Configuration Manager, the AddMembershipRules (WMI) class method adds more than one new rule to the CollectionRules property of the SMS_Collection Server WMI Class object.

The following syntax is simplified from

Managed Object Format (MOF) code and is intended to show the definition of the method.

SInt32 AddMembershipRules(
	 SMS_CollectionRule collectionRules[],
	 UInt32 QueryIDs[]
);

Parameters

collectionRules


Data type: SMS_CollectionRule ArrayQualifiers: [in]SMS_CollectionRule Server WMI Class objects to add.
QueryIDs


Data type: UInt32 ArrayQualifiers: [out]IDs corresponding to the rules. These are Configuration Manager-generated query IDs for query rules. The IDs for direct rules are set to 0. Use QueryID to modify or delete a query membership rule.

Return Values

An SInt32 data type that is 0 to indicate success or non-zero to indicate failure.

For information about handling returned errors, see About Configuration Manager Errors.

Remarks

The AddMembershipRules method does not validate a query rule, but simply adds it to the rules list. This can create debugging issues when the collection does not contain the intended membership. Your application should always validate the query rule before adding it to the collection rules by using the ValidateQuery Method in Class SMS_CollectionRuleQuery.

The AddMembershipRules method can also be used to modify membership rules. Only query rules can be modified.

Example Code

For an example that adds a direct rule and a query rule to a collection, see About Configuration Manager Collections.

Requirements

Runtime Requirements

Development Requirements

See Also


Send comments about this topic to Microsoft.