Edit

Share via


Get-CMCollectionDirectMembershipRule

Get a direct membership rule for a device or user collection.

Syntax

ByNameAndName (Default)

Get-CMCollectionDirectMembershipRule
    -CollectionName <String>
    [-ResourceName <String>]
    [<CommonParameters>]

ByNameAndValue

Get-CMCollectionDirectMembershipRule
    -CollectionName <String>
    -Resource <IResultObject>
    [<CommonParameters>]

ByNameAndId

Get-CMCollectionDirectMembershipRule
    -CollectionName <String>
    -ResourceId <String>
    [<CommonParameters>]

ByIdAndValue

Get-CMCollectionDirectMembershipRule
    -CollectionId <String>
    -Resource <IResultObject>
    [<CommonParameters>]

ByIdAndId

Get-CMCollectionDirectMembershipRule
    -CollectionId <String>
    -ResourceId <String>
    [<CommonParameters>]

ByIdAndName

Get-CMCollectionDirectMembershipRule
    -CollectionId <String>
    [-ResourceName <String>]
    [<CommonParameters>]

ByValueAndValue

Get-CMCollectionDirectMembershipRule
    -InputObject <IResultObject>
    -Resource <IResultObject>
    [<CommonParameters>]

ByValueAndId

Get-CMCollectionDirectMembershipRule
    -InputObject <IResultObject>
    -ResourceId <String>
    [<CommonParameters>]

ByValueAndName

Get-CMCollectionDirectMembershipRule
    -InputObject <IResultObject>
    [-ResourceName <String>]
    [<CommonParameters>]

Description

Use this cmdlet to get one or more direct membership rules for a device or user collection. A direct membership rule lets you explicitly choose the members of the device collection. Default collections don't have direct membership rules. Any collection that you target should have an ID that starts with the site code, not SMS. For more information, see How to create collections in Configuration Manager.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Get all direct membership rules for a collection by name

This command gets the direct membership rules for the collection named Device01.

Get-CMCollectionDirectMembershipRule -CollectionName "Device01"

Example 2: Get all direct membership rules by using the pipeline

This command uses the Get-CMCollection cmdlet to get the collection object named User02. It then uses the pipeline operator to pass the object to the Get-CMCollectionDirectMembershipRule cmdlet.

Get-CMCollection -Name "User02" | Get-CMCollectionDirectMembershipRule

Parameters

-CollectionId

Specify the ID of the collection to get the rule. This value is the CollectionID property, for example, XYZ00012. Since default collections can't have direct membership rules, this ID starts with the site code and not SMS.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Id

Parameter sets

ByIdAndValue
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIdAndId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIdAndName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CollectionName

Specify the name of the collection to get the rule.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Name

Parameter sets

ByNameAndName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByNameAndValue
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByNameAndId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

Specify an object for the collection to get the rule. To get this object, use the Get-CMCollection, Get-CMDeviceCollection, or Get-CMUserCollection cmdlets.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Collection

Parameter sets

ByValueAndValue
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueAndId
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueAndName
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Resource

Specify a resource, device, or user object to get its direct membership rule from the collection. To get this object, use the Get-CMResource, Get-CMDevice, or Get-CMUser cmdlets.

Parameter properties

Type:IResultObject
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByNameAndValue
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIdAndValue
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueAndValue
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceId

Specify the ID of the resource to get its direct membership rule from the collection. This value is the ResourceID property, for example 16777219.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

ByNameAndId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIdAndId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueAndId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceName

Specify the name of the device or user to get its direct membership rule from the collection.

Parameter properties

Type:String
Default value:None
Supports wildcards:True
DontShow:False

Parameter sets

ByNameAndName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIdAndName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByValueAndName
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object

Notes

This cmdlet is similar to Get-CMDeviceCollectionDirectMembershipRule and Get-CMUserCollectionDirectMembershipRule, which are specific to the type of collection. This cmdlet works with either device or user collections.