Edit

Share via


Add-CMDeviceCollectionIncludeMembershipRule

Add an include membership rule to a device collection.

Syntax

ByNameAndName (Default)

Add-CMDeviceCollectionIncludeMembershipRule
    -CollectionName <String>
    -IncludeCollectionName <String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByNameAndValue

Add-CMDeviceCollectionIncludeMembershipRule
    -CollectionName <String>
    -IncludeCollection <IResultObject>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByNameAndId

Add-CMDeviceCollectionIncludeMembershipRule
    -CollectionName <String>
    -IncludeCollectionId <String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByIdAndValue

Add-CMDeviceCollectionIncludeMembershipRule
    -CollectionId <String>
    -IncludeCollection <IResultObject>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByIdAndId

Add-CMDeviceCollectionIncludeMembershipRule
    -CollectionId <String>
    -IncludeCollectionId <String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByIdAndName

Add-CMDeviceCollectionIncludeMembershipRule
    -CollectionId <String>
    -IncludeCollectionName <String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByValueAndValue

Add-CMDeviceCollectionIncludeMembershipRule
    -InputObject <IResultObject>
    -IncludeCollection <IResultObject>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByValueAndId

Add-CMDeviceCollectionIncludeMembershipRule
    -InputObject <IResultObject>
    -IncludeCollectionId <String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByValueAndName

Add-CMDeviceCollectionIncludeMembershipRule
    -InputObject <IResultObject>
    -IncludeCollectionName <String>
    [-PassThru]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Use this cmdlet to add an include membership rule to a device collection. An include membership rule includes the members of another collection to the device collection where the rule is applied.

You can't add membership rules to default collections. Any collection that you target should have an ID that starts with the site code, not SMS. You can include a default collection, so the ID of an included collection can start with SMS.

Configuration Manager dynamically updates the membership of the device collection on a schedule if the membership of the included collection changes.

When you add an include membership rule to a collection, resources may become members of the collection. This action can cause any software or configuration deployment to apply to devices in the included collection.

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: Add an include membership rule

This command adds the device collection named All Systems with an include membership rule. The rule is added to the device collection named Device.

Add-CMDeviceCollectionIncludeMembershipRule -CollectionName "Device" -IncludeCollectionName "All Systems"

Example 2: Add an include membership rule to a collection by using the pipeline

This command first uses the Get-CMCollection cmdlet to get the target collection object named Device. It then uses the pipeline operator to pass the object to the Add-CMDeviceCollectionIncludeMembershipRule cmdlet, which adds an include membership rule for the device collection named All Systems.

Get-CMCollection -Name "Device" | Add-CMDeviceCollectionIncludeMembershipRule -IncludeCollectionName "All Systems"

Parameters

-CollectionId

Specify the ID of the device collection to add the rule. This value is the CollectionID property, for example, XYZ00012. Since default collections don't have include 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 device collection to add 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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IncludeCollection

Specify an object for the included collection to add to the rule. To get this object, use the Get-CMCollection or Get-CMDeviceCollection 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

-IncludeCollectionId

Specify the ID of the included collection to add to the rule. This value is the CollectionID property, for example, XYZ00012. You can include default collections, so this value can start with either the site code or SMS.

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

-IncludeCollectionName

Specify the name of the included collection to add to the rule.

Parameter properties

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

Parameter sets

ByNameAndName
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
ByValueAndName
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 device collection to add the rule. To get this object, use the Get-CMCollection or Get-CMDeviceCollection 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

-PassThru

Add this parameter to return an object that represents the item with which you're working. By default, this cmdlet may not generate any output.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
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