AddMembershipRules Method in Class SMS_Collection

The AddMembershipRules WMI class instance method adds new rules to the CollectionRules property of SMS_Collection. This method can also be used to modify membership rules.

The following syntax is simplified from MOF code and is intended to show you the definition of the method.

sint32 AddMembershipRules(
  [in] SMS_CollectionRule collectionRules[],
  [out] uint32 QueryIDs[]
); 

Parameters

  • collectionRules
    Data type: SMS_CollectionRule[] Qualifiers: In

    Any combination of one or more direct rules (SMS_CollectionRuleDirect) and query rules (SMS_CollectionRuleQuery).

  • QueryIDs
    Data type: uint32 Qualifiers: Out

    Array element is an SMS-generated query identifier if the corresponding rule is a query rule; if not, it is zero (0). Use QueryID to modify or delete a query membership rule.

Return Values

The AddMembershipRules method returns a sint32 which is always zero (0).

Example Code

For an example that adds a direct rule and a query rule to a collection, see Creating a Collection.

Remarks

The AddMembershipRules method does not validate your query, it simply adds it to the rules list. This can create debugging issues when the collection does not contains the intended membership. Always validate your query rule before adding it to the collection rules, using the ValidateQuery method of SMS_CollectionRuleQuery.

You can only modify query rules using the AddMembershipRules method. You cannot modify direct rules.

See Also

AddMembershipRule Method in Class SMS_Collection, SMS_Collection, SMS_CollectionRuleDirect, SMS_CollectionRuleQuery, ValidateQuery Method in Class SMS_CollectionRuleQuery