Add-CMDeviceCollectionDirectMembershipRule

Adds a Direct Rule membership rule to a device collection.

Syntax

Add-CMDeviceCollectionDirectMembershipRule
   -CollectionId <String>
   [-Confirm]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-PassThru]
   -ResourceId <Int32>
   [-WhatIf]
   [<CommonParameters>]
Add-CMDeviceCollectionDirectMembershipRule -CollectionId  [-Confirm] [-DisableWildcardHandling]
 [-ForceWildcardHandling] [-PassThru] -Resource  [-WhatIf] []
Add-CMDeviceCollectionDirectMembershipRule -CollectionName  [-Confirm] [-DisableWildcardHandling]
 [-ForceWildcardHandling] [-PassThru] -ResourceId  [-WhatIf] []
Add-CMDeviceCollectionDirectMembershipRule -CollectionName  [-Confirm] [-DisableWildcardHandling]
 [-ForceWildcardHandling] [-PassThru] -Resource  [-WhatIf] []
Add-CMDeviceCollectionDirectMembershipRule [-Confirm] [-DisableWildcardHandling] [-ForceWildcardHandling]
 -InputObject  [-PassThru] -ResourceId  [-WhatIf] []
Add-CMDeviceCollectionDirectMembershipRule [-Confirm] [-DisableWildcardHandling] [-ForceWildcardHandling]
 -InputObject  [-PassThru] -Resource  [-WhatIf] []

Description

The Add-CMDeviceCollectionDirectMembershipRule cmdlet adds a direct membership rule to a device collection. A direct membership rule lets you explicitly choose the members of the device collection.

Examples

Example 1: Add a direct membership rule

PS C:\>Add-CMDeviceCollectionDirectMembershipRule -CollectionId "SC100056" -ResourceId 2097152004

This command adds a device collection direct membership rule to the collection with the ID of SC100056, and adds the resource with the ID of 2097152004 to the collection.

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

PS C:\> Get-CMCollection -Name "testCollection" | Add-CMDeviceCollectionDirectMembershipRule -ResourceId 2097152004

This command gets the collection object named testCollection and uses the pipeline operator to pass the object to Add-CMDeviceCollectionDirectMembershipRule, which adds the direct membership rule to the collection object, and the resource with the ID of 2097152004 to the collection.This command gets the collection named Collection07 by using the Get-CMCollection cmdlet. The command passes the collection to the current cmdlet by using the pipeline operator. The cmdlet adds the direction membership rule that has the ID 2097152004 to that collection.

Required Parameters

-CollectionId

Specifies the ID of a device collection.

Type:String
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
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

Specifies a device collection object. To obtain a device collection object, use the Get-CMCollection 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:Int32
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
-DisableWildcardHandling

Indicates that wildcard handling is disabled.

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

Indicates that wildcard handling is enabled.

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

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

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