New-CMCollection

Create a device or user collection.

Syntax

New-CMCollection
   -CollectionType <CollectionType>
   [-Comment <String>]
   -LimitingCollectionName <String>
   -Name <String>
   [-RefreshSchedule <IResultObject>]
   [-RefreshType <CollectionRefreshType>]
   [-VariablePriority <Int32>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMCollection
   -CollectionType <CollectionType>
   [-Comment <String>]
   -InputObject <IResultObject>
   -Name <String>
   [-RefreshSchedule <IResultObject>]
   [-RefreshType <CollectionRefreshType>]
   [-VariablePriority <Int32>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-CMCollection
   -CollectionType <CollectionType>
   [-Comment <String>]
   -LimitingCollectionId <String>
   -Name <String>
   [-RefreshSchedule <IResultObject>]
   [-RefreshType <CollectionRefreshType>]
   [-VariablePriority <Int32>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

Use this cmdlet to create a device or user collection.

The limiting collection determines which resources can be a member of the collection that you create. For instance, when you use the All Systems collection as the limiting collection, since it's a device collection, the new device collection can include any device in the Configuration Manager hierarchy.

To scope the type of collection that you create, you can also use the New-CMDeviceCollection or New-CMUserCollection cmdlets.

After you create a collection, add resources to the collection with membership rules. To add members to the collection, use one of the cmdlets to add membership rules, for example:

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

Note

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

Examples

Example 1: Create a user collection

This command creates a user collection named testUser that sets the All Users collection as the limiting collection.

New-CMCollection -CollectionType User -LimitingCollectionName "All Users" -Name "testUser"

Example 2: Set the limiting collection through the pipeline

This command first uses the Get-CMCollection to get the All Users collection object. It then uses the pipeline operator to pass the object to the New-CMCollection cmdlet, which creates a collection named testUser. The limiting collection for the new testUser collection is the All Users collection.

Get-CMCollection -Name "All Users" | New-CMCollection -Name "testUser" -CollectionType "User"

Parameters

-CollectionType

Specify the type of collection to create. This parameter is functionally the same as using the New-CMDeviceCollection or New-CMUserCollection cmdlets.

Type:CollectionType
Accepted values:User, Device
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Comment

Specify an optional comment to describe and identify this collection.

Type:String
Position:Named
Default value:None
Required:False
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

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

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

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

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

-InputObject

Specify an object for the limiting collection. To get this object, use the Get-CMCollection, Get-CMDeviceCollection, or Get-CMUserCollection cmdlets.

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

-LimitingCollectionId

Specify the ID of the limiting collection. This value is the CollectionID property, for example, XYZ00012 or SMS00001.

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

-LimitingCollectionName

Specify the name of the limiting collection.

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

-Name

Specify the name for the new collection.

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

-RefreshSchedule

If you set the RefreshType parameter to either Periodic or Both, use this parameter to set the schedule. Specify a schedule object for when the site runs a full update of the collection membership. To get this object, use the New-CMSchedule cmdlet.

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

-RefreshType

Specify how the collection membership is updated:

  • Manual (1): An administrator manually triggers a membership update in the Configuration Manager console or with the Invoke-CMCollectionUpdate cmdlet.
  • Periodic (2): The site does a full update on a schedule. It doesn't use incremental updates. If you don't specify a type, this value is the default.
  • Continuous (4): The site periodically evaluates new resources and then adds new members. This type is also known as an incremental update. It doesn't do a full update on a schedule.
  • Both (6): A combination of both Periodic and Continuous, with both incremental updates and a full update on a schedule.

If you specify either Periodic or Both, use the RefreshSchedule parameter to set the schedule.

Note

The None value (0) is functionally the same as Manual.

Type:CollectionRefreshType
Accepted values:None, Manual, Periodic, Continuous, Both
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VariablePriority

Specify an integer value from 1-9 for the priority of device collection variables. 1 is the lowest priority, and 9 is the highest.

To create variables on a device collection, use the New-CMDeviceCollectionVariable cmdlet.

Type:Int32
Aliases:DeviceCollectionVariablePrecedence
Position:Named
Default value:None
Required:False
Accept pipeline input:False
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

IResultObject

Notes

For more information on this return object and its properties, see SMS_Collection server WMI class.