Add-CMUserCollectionExcludeMembershipRule

Add-CMUserCollectionExcludeMembershipRule

Adds an exclude membership rule to one or more Configuration Manager user collections.

Syntax

Parameter Set: ByCollectionIdAndExcludeCollectionId
Add-CMUserCollectionExcludeMembershipRule -CollectionId <String> -ExcludeCollectionId <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionIdAndExcludeCollectionName
Add-CMUserCollectionExcludeMembershipRule -CollectionId <String> -ExcludeCollectionName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionIdAndExcludeCollectionValue
Add-CMUserCollectionExcludeMembershipRule -CollectionId <String> -ExcludeCollection <IResultObject> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionNameAndExcludeCollectionId
Add-CMUserCollectionExcludeMembershipRule -CollectionName <String> -ExcludeCollectionId <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionNameAndExcludeCollectionName
Add-CMUserCollectionExcludeMembershipRule -CollectionName <String> -ExcludeCollectionName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionNameAndExcludeCollectionValue
Add-CMUserCollectionExcludeMembershipRule -CollectionName <String> -ExcludeCollection <IResultObject> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionValueAndExcludeCollectionId
Add-CMUserCollectionExcludeMembershipRule -Collection <IResultObject> -ExcludeCollectionId <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionValueAndExcludeCollectionName
Add-CMUserCollectionExcludeMembershipRule -Collection <IResultObject> -ExcludeCollectionName <String> [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByCollectionValueAndExcludeCollectionValue
Add-CMUserCollectionExcludeMembershipRule -Collection <IResultObject> -ExcludeCollection <IResultObject> [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Add-CMUserCollectionExcludeMembershipRule cmdlet adds a rule that excludes the members of another collection from the user collections where the rule is applied. You can specify the user collections where the rule is applied by using their names, IDs, or by specifying an object that represents the collections. You can specify the collection whose members are excluded by using its name, ID, or an object that represents the collection.

Microsoft System Center 2012 Configuration Manager dynamically updates the membership of the user collection on a schedule if the membership of the excluded collection changes. For more information on these rules, see Introduction to Collections in Configuration Manager (https://go.microsoft.com/fwlink/p/?LinkID=259433) in the TechNet library.

Parameters

-Collection<IResultObject>

Specifies a Configuration Manager user collection object. To obtain a user collection object, use the Get-CMUserCollection cmdlet.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CollectionId<String>

Specifies the IDs of the user collections where the rule is applied.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-CollectionName<String>

Specifies the name of a user collection where the rule is applied.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ExcludeCollection<IResultObject>

Specifies an object that represents the collection whose members are excluded from the user collections.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ExcludeCollectionId<String>

Specifies the ID of the collection whose members are excluded from the user collections.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ExcludeCollectionName<String>

Specifies the name of the collection whose members are excluded from the user collections.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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

Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

Examples

Example 1: Add an exclude membership rule to a user collection

This command adds an exclude membership rule that has the ID SMSDM001 to the Configuration Manager user collection that has the ID 9990000D.

PS C:\> Add-CMUserCollectionExcludeMembershipRule –CollectionId "9990000D" –ExcludeCollectionId "SMSDM001"

Get-CMUserCollectionExcludeMembershipRule

Remove-CMUserCollectionExcludeMembershipRule

Get-CMUserCollection