Get-CMDeviceCollectionDirectMembershipRule

Get-CMDeviceCollectionDirectMembershipRule

Gets the direct membership rules of device collections in the Configuration Manager hierarchy.

Syntax

Parameter Set: ByCollectionNameAndResourceName
Get-CMDeviceCollectionDirectMembershipRule -CollectionName <String> -ResourceName <String> [ <CommonParameters>]

Parameter Set: ByCollectionIdAndResourceId
Get-CMDeviceCollectionDirectMembershipRule -CollectionId <String> -ResourceId <Int32> [ <CommonParameters>]

Parameter Set: ByCollectionIdAndResourceName
Get-CMDeviceCollectionDirectMembershipRule -CollectionId <String> -ResourceName <String> [ <CommonParameters>]

Parameter Set: ByCollectionNameAndResourceId
Get-CMDeviceCollectionDirectMembershipRule -CollectionName <String> -ResourceId <Int32> [ <CommonParameters>]

Parameter Set: ByCollectionValueAndResourceId
Get-CMDeviceCollectionDirectMembershipRule -Collection <IResultObject> -ResourceId <Int32> [ <CommonParameters>]

Parameter Set: ByCollectionValueAndResourceName
Get-CMDeviceCollectionDirectMembershipRule -Collection <IResultObject> -ResourceName <String> [ <CommonParameters>]

Detailed Description

The Get-CMDeviceCollectionDirectMembershipRule cmdlet gets the direct membership rules of one or more collections. You can specify the device collections by using their names, IDs, or by specifying an object that represents the collections.

A direct rule lets you explicitly choose the members of the device collection. For more information about collection 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 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 collection.

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

-ResourceId<Int32>

Specify the ID of the rule that you want to retrieve. To retrieve all the direct rules for the collections leave this parameter blank.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ResourceName<String>

Specifies the name of the rule that you want to retrieve.

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 all direct membership rules

This command gets all the direct membership rules of the device collection that has the ID CM0001A.

PS C:\> Get-CMDeviceCollectionDirectMembershipRule -CollectionID "CM0001A" -ResourceId ""

Add-CMDeviceCollectionDirectMembershipRule

Remove-CMDeviceCollectionDirectMembershipRule

Get-CMUserCollection