How to Create SCCM Dynamic Collection Based on Device Type

In ConfigMgr / MECM / SCCM , a dynamic collection membership is based on query rules. A dynamic collection can have multiple queries and collection membership updates at each collection evaluation cycle.

A dynamic or query based collection reduce the efforts required to manage a deployment as devices are automatically included or excluded in a collection based on query rules.

In this blog post, we will discuss about collection queries for virtual Devices, Desktops and Laptops. We will share few sample queries. These useful collection queries have been tested with System Center configuration manager current branch version 2111 and can be used in a collection to get the desired results.


Related post: If you are looking for step by step process to create a dynamic / query based collection then follow this article : How to Create Dynamic Collection in SCCM

Other posts in this series:


SCCM Collection Query for Virtual Machines:

SCCM Collection Query for Virtual Machines (Client & Server OS)

The below WMI Query Language ( WQL ) query will include all virtual machines in a collection.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model like "%virtual%"

SCCM Collection Query for Virtual Machines (Client OS)

If you want to further limit this only for workstations operating system ( e.g Windows 111 / Windows 10 / Windows 7 etc.) then below query can be used.

select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from  SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model like "%virtual%" and SMS_R_System.OperatingSystemNameandVersion like "%Workstation%"

SCCM Dynamic Collection Query for Laptops & Desktops

As you seen in above example, the WQL query for selecting all virtual machines was a bit easier. We can simply check for the model and get the desired result. However when it’s come to physical devices, the Model represent the actual hardware model’s such as Dell Latitude 5420 or Lenovo Thinkpad T490. Hence different approach need to be followed here.

Win32_SystemEnclsoure Class

The Win32_SystemEnclosure WMI class represent the properties that are associated with a physicals system enclosure. You can check Chassis Type information using PowerShell Get-WmiObject cmdlet.

Chassis Type | Dynamic Collection

The SystemEnclosure information collected from clients are stored on SMS_G_SYSTEM_SYSTEM.ENCLOSURE class in SCCM.

The ChassisTypes field can be used to identify if a device is Desktop, Laptop or Tablet.

Follow this article to know more about ChassisTypes and their values.

SCCM Collection Query for Laptops

For creating a collection for all laptops, we can look for all chassis types for laptops in SMS_G_System_SYSTEM.ENCLOSURE.ChassisTypes. See the complete WQL query below. This query can be used in collection query to include all laptops in the collection.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceID = SMS_R_System.ResourceId where  SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes in ( "8", "9", "10","11", "12", "14","18","21")

For creating a collection for all laptops, we can look for all chassis types for laptops in SMS_G_System_SYSTEM.ENCLOSURE.ChasisTypes. See the complete WQL query below. This query can be used in collection query to include all desktops in the collection.

SCCM Device Collection Query for Desktops

For creating a collection for all desktops, we can look for all chasis types for laptops in SMS_G_System_SYSTEM.ENCLOSURE.ChasisTypes. See the complete WQL query below. This query can be used in collection query to include all laptops in the collection.

select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceID = SMS_R_System.ResourceId where SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes in ("3","4","5","6","7","15","16")

SCCM Device Collection Query for Desktops (Without virtual machines)

The Chassis Type value 3 includes virtual machine as well. If you want to exclude virtual machines from collection then above WQL can be modified to exclude virtual machine . Please see complete WQL below.

select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from  SMS_R_System inner join SMS_G_System_SYSTEM_ENCLOSURE on SMS_G_System_SYSTEM_ENCLOSURE.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_SYSTEM_ENCLOSURE.ChassisTypes in ("2","3","5","6","7","35","15","4") and SMS_G_System_COMPUTER_SYSTEM.Model not like "%Virtual%"

Related Posts:

Subscribe to Techuisitive Newsletter

Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.

Scroll to Top