Remove-CMUserCollectionDirectMembershipRule

Remove a direct membership rule from a user collection.

Syntax

Remove-CMUserCollectionDirectMembershipRule
      -CollectionName <String>
      -ResourceName <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -CollectionName <String>
      -Resource <IResultObject[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -CollectionName <String>
      -ResourceId <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -CollectionId <String>
      -Resource <IResultObject[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -CollectionId <String>
      -ResourceId <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -CollectionId <String>
      -ResourceName <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -InputObject <IResultObject>
      -Resource <IResultObject[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -InputObject <IResultObject>
      -ResourceId <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMUserCollectionDirectMembershipRule
      -InputObject <IResultObject>
      -ResourceName <String[]>
      [-Force]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Use this cmdlet to remove a direct membership rule from a user collection. A direct membership rule lets you explicitly choose the members of the user 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.

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

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 a direct membership rule from a user collection

This command removes the direct membership rule for the resource with ID 33555693 from the user collection that has the ID XYZ0001A.

Remove-CMUserCollectionDirectMembershipRule -CollectionID "XYZ0001A" -ResourceId "33555693"

Parameters

-CollectionId

Specify the ID of the user collection with the direct rule to remove. For example, "XYZ0003F".

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 user collection with the direct rule to remove.

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

Run the command without asking for confirmation.

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

-InputObject

Specify a user collection object with the direct rule to remove. To get this object, use the Get-CMCollection or Get-CMUserCollection cmdlets.

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

-Resource

Specify an array of resource objects to remove from the user collection. To get this object, use the Get-CMResource or Get-CMUser cmdlets.

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

-ResourceId

Specify an array of resource IDs to remove from the user collection. This value is the ResourceId property of the SMS_Resource class. For example, "33555693".

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

-ResourceName

Specify an array of resource names to remove the direct membership rules from the user collection.

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

-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