How To Create A Device Collection In SCCM | Step By Step Guide

Jason Barrett Jason Barrett | | ConfigMgr

In this article I will show you how to create a device collection in SCCM and I will cover all the ways you can add members to the collection.

I will also give you my top tips in creating device collections such as how you can use powershell to automate most of the heavy work.

In this article you will learn the following.

What Is A SCCM Device Collection?

A SCCM device collection is a group of SCCM devices or users.  The SCCM group is exactly the same as an active directory group apart from it can only be used in SCCM.

There are four methods that you can use to configure the members of the group which include

Direct Rule

A direct rule is when you add a single device or user to a device collection.  This can be done manually in the ConfigMgr console, or in bulk using powershell which I will show you later in this article.

Query Rule

You can use a SQL query rule to include all devices with a certain criteria such as

  • Include SMS_R_SYSTEM.Name LIKE WINDOWS% = Include all devices starting with WINDOWS
  • Include SMS_R_SYSTEM.Name LIKE %VM% = Include all devices that have VM in their name
  • Include SMS_G_System_OPERATING_SYSTEM.Caption LIKE %Windows 10% = Include all machines with Windows 10 OS

Include Rule

Include members in another SCCM device collection in this collection

Exclude Rule

Exclude members in another SCCM device collection in this collection

How To Create A Device Collection In SCCM

Below I will start off by showing you how to create a basic device collection

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections  (Here it will show all the currently created device collections)
  3. If you have a large environment I recommend to create device collections within folders to make it easier to find device collections. By default I always create the following folders.  Devices, Deployments, Software Updates
  4. To create a folder right click on Device Collections in the left menu, then select Folder > Create Folder
  5. To create a device collection click on “Create Device Collection” in the top menu
    How To Create A Device Collection In SCCM
  6. A wizard will now appear as shown below
    Create Device Collection Wizard
  7. First enter a name for the collection.  Make sure to give it a good descriptive name, With all environments I have managed they have had 100’s of device collections, giving it a good name will help you to find it later when you need it.  I typically will give it a name such as
    Device | UK Windows 2016
    Device | UK Windows 2022
    Device | USA Windows 2016
    Software Update | Week 2 Day 3
    Deployment | Adobe Reader 64 Bit
  8. Now we need to select a limiting collection, click browse and select “All Systems” then ok (More on Limiting Collections Later In This Article)
  9. Click Next
  10. Select Add Rule > Direct Rule
    select sccm device membership rule
  11. click next
  12. In the value field enter the name of the device you want to add to the collection
    create direct membership rule wizard
  13. Click next
  14. On the next screen your device should show, tick the box next to the device you want to include and hit next
    verify direct membership rule
  15. Click Next
  16. Click Close
  17. Now verify the correct device is showing under membership rules
    define direct membership rule
  18. If you want to add more devices in to the collection you can click add rule and repeat steps 10 – 16
  19. Leave incremental updates and update scan as default (More info on these settings below)
  20. Click Next
  21. Click Next
  22. Click Close
  23. You will now see your created device collection under the Device Collections
  24. Below you can see I just created “Devices | UK Test Windows 2016” the limiting collection is all systems and it has 1 member
    created sccm device collection

How To Add Multiple Devices To A Device Collection

There are two main ways to add multiple devices to a device collection

  • Manually via the ConfigMgr console | I recommend if adding 1-10 devices
  • Automated with Powershell | If adding 11 or more devices

Manually via the ConfigMgr console

To add multiple devices via the ConfigMgr Console follow these steps

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. Right click on the device collection you want to add members to
  4. Click add resources
    adding multiple devices to a collection in SCCM
  5. In “Name String Contains” enter part or all of the device name you want to search for
  6. Click the search button
  7. The results will be shown under search results
  8. highlight the devices you want to add and click add
  9. The devices will appear under selected resources
    Add Multiple Devices Via ConfigMgr
  10. Repeat steps 5 – 8 as needed
  11. Click ok
  12. In the console it will not show the new added devices strait away (Only 1 device showing as per the screenshot below)
  13. You can either wait a few minutes or you can force an update by doing the following
  14. Right click on the device collection
  15. Click update membership
  16. Wait 10 seconds
  17. Right click on the device collection
  18. Select Refresh
    update sccm device collection membership
  19. The new added devices will now show
    new added sccm device collection members

Automated with Powershell

If you have a list of devices you need to add to an SCCM collection you can use powershell to speed up the process. To do this follow these steps

To bulk add devices in to a sccm device collection follow these steps

  1. Log on your ConfigMgr server
  2. Create the file C:\Devices.txt and put the devices in the file that you want to add to the collection
  3. Open the ConfigMgr console
  4. Open “Windows Powershell ISE” via the ConfigMgr tool bar
    open powershell via configmgr
  5. Powershell ISE will now open, Enter the below code at the bottom of the powershell window
  6. Get-Content “C:\Devices.txt” | foreach { Add-CMDeviceCollectionDirectMembershipRule -CollectionName “Collection Name” -ResourceID (Get-CMDevice -Name $_).ResourceID }
  7. Replace Collection Name with the name of the device collection you want to update
  8. Click Run
    add devices to sccm collection via powershell
  9. If all went ok you should not see any errors or updates as shown above

If you are looking to create and update lots of device collections check out this article I wrote about how to automate this with powershell.

How To Create A Device Collection With a Query Rule

You can populate an SCCM device collection with a query rule which is useful if you have a group that is constantly changing.

For example at my company we are migrating from windows 2008 to windows 2016, Instead of manually updating my “Devices | Windows 2016” device collection I can configure it to add any devices that have windows 2016 installed on them. Below I will show you how I created this device collection to only show windows 2016 devices.

To create a device collection with a query rule follow these steps

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. Click “Create Device Collection” in the top menu
    How To Create A Device Collection In SCCM
  4. Enter a name for the collection
  5. Select a limiting collection, click browse and select “All Systems” then ok
  6. Click Next
  7. Select Add Rule > Query Rule
    create SCCM device collection via query rule
  8. click next
  9. Give the query rule a name, in the example below I added “Windows 2016 Devices”
    query rule name
  10. Click Edit Query Statement
  11. To add the query you need to add a SQL query, You can get the query you need in this article I wrote about Query Rules
  12. Click the criteria tab
  13. Click the Show Query Language button
    query statement properties
  14. Paste the query under Query Statement
  15. To confirm the query statement is correct hit the play button
  16. A new window will pop up, hit run
  17. Verify the Rows Returned is what you expect to see
    sccm query statement result
  18. Click Ok
  19. Click Ok to close the query window
  20. Confirm your membership rule appears with a type of query
  21. Click Next
    sccm device collection query completed
  22. Click Next
  23. Click Close
  24. Confirm the correct number of devices are showing in the device collection, If it is not perform the next few steps
  25. Click update membership
  26. Wait 10 seconds
  27. Right click on the device collection
  28. Select Refresh

How To Create A Device Collection With Include & Exclude Rule

Creating a device collection with a include rule is basically adding groups of devices to a device collection.  You can then add an exclude group to exclude the devices in that collection.

In the below example I want to create a device collection with the following details

  • All Systems That Were Created In The Last 14 Days
  • That Are Not Windows Server 2008 Machines

To create a device collection with include and exclude rules follow these steps

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. Click “Create Device Collection” in the top menu
  4. Enter a name, in my example I will use “Devices | Created Last 14 Days Not Windows 2008”
  5. Limiting Collection select “All Systems” as this will query all systems
    create device collection with include and exclude rules
  6. Click Next
  7. Click Add Rule then click include collections
    adding include rule to sccm device collection
  8. Tick the box next to the collections you want to include. If you want to create a device collection that shows you new machines take a look at this article
    select include collections
  9. Click Ok
  10. The device collection will now show us all the machines that were created in the last 14 days, including windows server 2008 machines
  11. Next click on exclude collections
    adding exclude rule to sccm device collection
  12. Tick the box next to the collection you want to exclude
  13. Click ok
  14. Review the Membership rules
    include and exclude rules applied
  15. Click Next
  16. Click Next
  17. Click Close
  18. To view the devices in this device collection right click on it and select show members
  19. In the device collection I just created you can see that 19 Windows 2016 machines have been created
  20. You can see one device is inactive, you could add an exclude rule to exclude inactive clients which will give you a more accurate result
    include device collection result

How To Use Limiting Collections

When you create any type of device collection you need to specify a limiting collection.  A limiting collection will limit the devices that you can add to your device collection.

For example if I set the limiting collection to “Windows 2016 Machines” Only windows 2016 machines can be added to the collection.

To set the limiting collection on a sccm device collection do the following.

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. If creating a new device collection, click create new device collection, then click browse next to Limiting Collection
  4. If editing an existing collection then right click on it and select properties, then click browse next to Limiting Collection
  5. Tick the box next to the collection you want to exclude
  6. Click ok
  7. Click ok

How To Configure Incremental And Full Updates

After you create a device collection SCCM will constantly update the collection with incremental and full updates.  It is very important to understand what the difference is between them and how to configure them.

Incremental Updates

An incremental update uses a collection evaluation graph to evaluate and update collections. It is recommended to only enable this option to device collections that need to update frequently and do not enable on more than 200 device collections as this will affect performance of the ConfigMgr server.

It is recommended to only apply incremental updates on the following types of device collections

  • Security
  • Client Settings
  • Software Update / Maintenance Windows 

To enable incremental updates on a device collection do the following

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. Right click on a device collection and select properties
  4. Click the Membership Rules tab
  5. Tick the box “Use incremental updates for this collection”
  6. Click ok

Full Updates

A full collection by default runs once a week and it will evaluate the device collection as well as the limiting device collection used.

It is recommended to keep the full update to a week or more as anything more frequent will put more strain on the ConfigMgr server and could cause performance issues.

To change a full update schedule do the following.

  1. Open ConfigMgr
  2. Go to \Assets and Compliance\Overview\Device Collections
  3. Right click on a device collection and select properties
  4. Click the Membership Rules tab
  5. Click on schedule
  6. Change the schedule as required
  7. Click Ok
  8. Click Ok

Best Practices For Creating Device Collections

There are many best practices that I apply when creating and maintaining device collections.  Below is a list of things I do

Use Good Descriptive Names

It is important to use good descriptive names for your device collections so you can easily find them as your environment grows. For this I do two things

The first thing I do is create folders and place the device collections in these folders.  Typically I will create folders for

  • Device Specific 
  • Deployments
  • Software Updates
  • Retired Collections

Below is a screenshot of what I have done in the environment I look after.

device collection names

Give the device collection itself a good descriptive name such as

  • Device | UK Windows 2016
  • Device | UK Windows 2022
  • Device | USA Windows 2016
  • Software Update | Week 2 Day 3
  • Deployment | Adobe Reader 64 Bit

Avoid names such as “Testing Deployment” “Software Update Group” and so on.

Avoid Frequent Device Collection Updates

If you have 100’s of device collections this can have an impact on the system if they are set to update frequently.

Incremental updates should only be enabled on device collections you need to update frequently and it is recommended not to enable incremental updates on more than 200 device collections.

Full updates should be configured to run once a week, Choose a time when your sccm server is not busy processing requests.