Set-CMCollection
Configure a device or user collection.
Syntax
SetByValue (Default)
Set-CMCollection
-InputObject <IResultObject>
[-Comment <String>]
[-LimitingCollection <IResultObject>]
[-LimitingCollectionId <String>]
[-LimitingCollectionName <String>]
[-NewName <String>]
[-PassThru]
[-RefreshSchedule <IResultObject>]
[-RefreshType <CollectionRefreshType>]
[-VariablePriority <Int32>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SetById
Set-CMCollection
-CollectionId <String>
[-Comment <String>]
[-LimitingCollection <IResultObject>]
[-LimitingCollectionId <String>]
[-LimitingCollectionName <String>]
[-NewName <String>]
[-PassThru]
[-RefreshSchedule <IResultObject>]
[-RefreshType <CollectionRefreshType>]
[-VariablePriority <Int32>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SetByName
Set-CMCollection
-Name <String>
[-Comment <String>]
[-LimitingCollection <IResultObject>]
[-LimitingCollectionId <String>]
[-LimitingCollectionName <String>]
[-NewName <String>]
[-PassThru]
[-RefreshSchedule <IResultObject>]
[-RefreshType <CollectionRefreshType>]
[-VariablePriority <Int32>]
[-DisableWildcardHandling]
[-ForceWildcardHandling]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Use this cmdlet to configure a device or user collection.
The limiting collection determines which resources can be a member of the collection. For instance, when you use the All Systems collection as the limiting collection, the new collection can include any device in the Configuration Manager hierarchy.
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:
You can't configure default collections. Any collection that you target should have an ID that starts with the site code, not SMS
.
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: Rename a collection
The first command gets the collection object named testUser and stores it in the $userCollection variable.
The second command updates the name of the collection.
$userCollection = Get-CMCollection -Name "testUser"
Set-CMCollection -InputObject $userCollection -NewName "newTestUser"
Parameters
-CollectionId
Specify the ID of the collection to configure. This value is the CollectionID property, for example, XYZ00012
. You can't configure default collections, so this value starts with the site code, not SMS
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
SetById
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Comment
Specify an optional comment to describe and identify this collection.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: | SwitchParameter |
Default value: | False |
Supports wildcards: | False |
DontShow: | False |
Aliases: | cf |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-DisableWildcardHandling
This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ForceWildcardHandling
This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-InputObject
Specify a collection object to configure. To get this object, use the Get-CMCollection, Get-CMDeviceCollection, or Get-CMUserCollection cmdlets.
Parameter properties
Type: | IResultObject |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | Collection |
Parameter sets
SetByValue
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-LimitingCollection
Specify an object for the limiting collection. To get this object, use the Get-CMCollection, Get-CMDeviceCollection, or Get-CMUserCollection cmdlets.
Parameter properties
Type: | IResultObject |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-LimitingCollectionId
Specify the ID of the limiting collection. This value is the CollectionID property, for example, XYZ00012
or SMS00001
.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | LimitToCollectionId |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-LimitingCollectionName
Specify the name of the limiting collection.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | LimitToCollectionName |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Name
Specify the name of a collection to configure.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
SetByName
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-NewName
Specify a new name for the collection. Use this parameter to rename it.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-PassThru
Add this parameter to return an object that represents the item with which you're working. By default, this cmdlet may not generate any output.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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.
Parameter properties
Type: | IResultObject |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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 bothPeriodic
andContinuous
, 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
.
Parameter properties
Type: | CollectionRefreshType |
Default value: | None |
Accepted values: | None, Manual, Periodic, Continuous, Both |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | 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 configure variables on a device collection, use the Set-CMDeviceCollectionVariable cmdlet.
To view the current variable priority, use the Get-CMCollectionSetting cmdlet.
Parameter properties
Type: | Int32 |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | DeviceCollectionVariablePrecedence |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet doesn't run.
Parameter properties
Type: | SwitchParameter |
Default value: | False |
Supports wildcards: | False |
DontShow: | False |
Aliases: | wi |
Parameter sets
(All)
Position: | Named |
Mandatory: | False |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Inputs
Microsoft.ConfigurationManagement.ManagementProvider.IResultObject
Outputs
System.Object
Related Links
- Copy-CMCollection
- Export-CMCollection
- Get-CMCollection
- Get-CMCollectionMember
- Get-CMCollectionSetting
- Import-CMCollection
- Invoke-CMCollectionUpdate
- New-CMCollection
- Remove-CMCollection
- Set-CMCollection
- Set-CMDeviceCollectionVariable
- Get-CMDeviceCollection
- Get-CMUserCollection
- How to create collections in Configuration Manager