Adding machines to device collections using the GUI can take quite a lot of time to achieve. Performing the task via Powershell takes a fraction of the time and can be expanded upon so that you can add multiple machines from various sources (text file, AD group etc).
- Test the collection using Get-CMCollection -Name $CollectionName
- Specify your device collection’s name in $CollectionName
- Specify your device name in $DeviceName
- The Add-CMDeviceCollectionDirectMembershipRule commandlet will then add the device to the device collection
$CollectionName = "Test1" $DeviceName = "Computer1" Add-CMDeviceCollectionDirectMembershipRule -CollectionName "$CollectionName" -ResourceID $(get-cmdevice -name "$DeviceName").ResourceID