Get-CMDeviceCollectionQueryMembershipRule

Get-CMDeviceCollectionQueryMembershipRule

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

Syntax

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

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

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

Detailed Description

The Get-CMDeviceCollectionQueryMembershipRule cmdlet retrieves rules from the specified device collections. You can specify the device collections where the rule is applied by names, IDs, or an input object that represents the device 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, see Introduction to Collections in Configuration Manager (https://go.microsoft.com/fwlink/p/?LinkID=259433) on TechNet.

Parameters

-Collection<IResultObject>

Specifies a Configuration Manager device collection object. To obtain a device collection object, use the Get-CMDeviceCollection 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 device collections 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 device 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 the query membership rules for a device collection

This command gets the query membership rule named Remote Users By Domain from device collection named Remote Users.

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

Add-CMUserCollectionQueryMembershipRule

Remove-CMUserCollectionQueryMembershipRule

Get-CMUserCollection

Get-CMDeviceCollection

Introduction to Collections in Configuration Manager