New-CMCollection

Creates a collection.

Syntax

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

Description

The New-CMCollection cmdlet creates a collection in Microsoft System Center Configuration Manager.

Examples

Example 1: Create a collection and specify its scope

PS C:\> New-CMCollection -CollectionType User -LimitingCollectionName "All Users" -Name "testUser"

This command creates a user collection named testUser that establishes the All Users collection as the scope from which you can add members.

Example 2: Create a collection based on an existing one

PS C:\> Get-CMCollection -Name "All Users" | New-CMCollection -Name "testUser" -CollectionType "User"

This command gets the collection object named All Users and uses the pipeline operator to pass the object to New-CMCollection. New-CMCollection creates a collection named testUser that is based on the membership of the All Users collection.

Required Parameters

-CollectionType

Specifies a type for the collection. Valid values are:- Root

  • User
  • Device
  • Unknown
Type:CollectionType
Parameter Sets:User, Device
Required:True
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

Specifies a collection object to use as a scope for this collection. To obtain a collection object, use the Get-CMCollection cmdlet.

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

Specifies the ID of a collection to use as a scope for this collection.

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

Specifies the name of a collection to use as a scope for this collection.

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

Specifies a name for the collection.

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

Optional Parameters

-Comment

Specifies a comment for the collection.

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

Specifies a schedule that determines when Configuration Manager refreshes the collection.

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

Specifies how Configuration Manager refreshes the collection. Valid values are:- None

  • Manual
  • Periodic
  • Continuous
  • Both
Type:CollectionRefreshType
Parameter Sets:None, Manual, Periodic, Continuous, Both
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

Outputs

IResultObject#SMS_Collection