Remove-CMDeviceCollectionIncludeMembershipRule

Remove an include membership rule from a device collection.

Syntax

Remove-CMDeviceCollectionIncludeMembershipRule
      -CollectionName <String>
      -IncludeCollectionName <String>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -CollectionName <String>
      -IncludeCollection <IResultObject>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -CollectionName <String>
      -IncludeCollectionId <String>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -CollectionId <String>
      -IncludeCollection <IResultObject>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -CollectionId <String>
      -IncludeCollectionId <String>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -CollectionId <String>
      -IncludeCollectionName <String>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -InputObject <IResultObject>
      -IncludeCollection <IResultObject>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -InputObject <IResultObject>
      -IncludeCollectionId <String>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMDeviceCollectionIncludeMembershipRule
      -InputObject <IResultObject>
      -IncludeCollectionName <String>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

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

For more information, see How to create collections in Configuration Manager.

When you remove an include membership rule to a collection, a resource may no longer be a member of the device collection. This action can cause any software or configuration deployment to not apply to a device.

Note

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

Examples

Example 1: Remove an include membership rule

This command removes the include membership rule for the All Systems collection from the device collection named Device. Specifying the Force parameter indicates that the membership rule is removed without prompting you.

Remove-CMDeviceCollectionIncludeMembershipRule -CollectionName "Device" -IncludeCollectionName "All Systems" -Force

Example 2: Remove an include membership rule by using the pipeline

This command first uses the Get-CMCollection cmdlet to get the device collection object named Device. It then uses the pipeline operator to pass the object to the Remove-CMDeviceCollectionIncludeMembershipRule cmdlet.

Get-CMCollection -Name "Device" | Remove-CMDeviceCollectionIncludeMembershipRule -IncludeCollectionName "All Systems" -Force

Parameters

-CollectionId

Specify the ID of the device collection to remove 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.

Type:String
Aliases:Id
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-CollectionName

Specify the name of the device collection to remove the rule.

Type:String
Aliases:Name
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IncludeCollection

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

Type:IResultObject
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-IncludeCollectionId

Specify the ID of the included collection to remove 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.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-IncludeCollectionName

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

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

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

Type:IResultObject
Aliases:Collection
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object