Remove-CMDeviceCollectionDirectMembershipRule

Removes a direct membership rule from a device collection.

Syntax

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

Description

The Remove-CMDeviceCollectionDirectMembershipRule cmdlet removes a direct membership rule from a device collection.

Examples

Example 1: Remove a direct membership rule

PS C:\> Remove-CMDeviceCollectionDirectMembershipRule -CollectionName "Device01" -ResourceId 2097152004 -Force

This command removes the direct membership rule for the resource with the ID of 2097152004 from the collection named Device01. Specifying the Force parameter indicates that the user is not prompted before the rule is removed.

Example 2: Remove a direct membership rule by using the pipeline

PS C:\> Get-CMCollection -Name "Device02" | Remove-CMDeviceCollectionDirectMembershipRule -Force

This command gets the collection object named Device02 and uses the pipeline operator to pass the object to Remove-CMDeviceCollectionDirectMembershipRule which removes the direct membership rule for the resource with the ID of 2097152004 from the collection object. Specifying the Force parameter indicates that the user is not prompted before the rule is removed.

Required Parameters

-CollectionId

Specifies the ID of a device collection.

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

Specifies the name of a device collection.

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

Specifies the input to this cmdlet. You can use this parameter, or you can pipe the input to this cmdlet.

Type:IResultObject
Aliases:Collection
Required:True
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Resource

Specifies a resource object. To obtain a resource object, use the Get-CMResource cmdlet.

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

Specifies the ID of a resource.

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

Specifies the name of a resource.

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

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

Forces the command to run without asking for user confirmation.

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

Shows what would happen if the cmdlet runs. The cmdlet is not run.

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