Get-CMUserCollectionQueryMembershipRule

Get-CMUserCollectionQueryMembershipRule

Gets the query membership rules from one or more user collections in the Configuration Manager hierarchy.

Syntax

Parameter Set: ByCollectionName
Get-CMUserCollectionQueryMembershipRule -CollectionName <String> -RuleName <String> [ <CommonParameters>]

Parameter Set: ByCollectionId
Get-CMUserCollectionQueryMembershipRule -CollectionId <String> -RuleName <String> [ <CommonParameters>]

Parameter Set: ByCollectionValue
Get-CMUserCollectionQueryMembershipRule -Collection <IResultObject> -RuleName <String> [ <CommonParameters>]

Detailed Description

The Get-CMUserCollectionQueryMembershipRule cmdlet retrieves rules from the specified user collections. You can specify the user collections where the rule is applied by using their names, IDs, or by specifying an input object that represents the user collections. The query is specified by its ID or name.

A query rule lets you dynamically update the membership of a collection based on a query that is run on a schedule. For more information about membership rules in Microsoft System Center 2012 Configuration Manager, see Introduction to Collections in Configuration Manager (https://go.microsoft.com/fwlink/p/?LinkID=259433) in the TechNet library.

Parameters

-Collection<IResultObject>

Specifies a Configuration Manager user collection object. To obtain a user collection object, use the Get-CMUserCollection cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CollectionId<String>

Specifies the ID of the user collection where the rule is applied.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CollectionName<String>

Specifies the name of the user collection where the rule is applied.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-RuleName<String>

Specifies the name of the query rule.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Get a rule by using a collection name

This command gets the rule named Remote Users by Domain that belongs to the collection named Remote Users.

PS C:\> Get-CMUserCollectionQueryMembershipRule -CollectionName "Remote Users" -RuleName "Remote Users by Domain"

Get-CMUserCollection

Add-CMUserCollectionQueryMembershipRule

Remove-CMUserCollectionQueryMembershipRule