Posted on March 24, 2016 · Posted in SCCM

SCCM and WMI Query to Find All Laptops and Desktops

To install special software on all portable devices of the company it was necessary to build an SCCM collection, which would include all laptops (an other portable mobile systems) in a corporate network. At once I could not find the system property to explicitly identify a computer as a laptop or a desktop.

To begin with, I tried to filter portable devices using WMI filters of GPO and install software to them using group policies. There were several variants to create WMI queries by means of checking:

  • Battery status (only laptops have it): SELECT * FROM Win32_Battery WHERE (BatteryStatus <> 0)
  • RAM type (SODIMM for laptops): Select * from Win32_PhysicalMemory WHERE (FormFactor = 12)
  • PCSystemType properties: SELECT * FROM Win32_ComputerSystem WHERE PCSystemType = 2

Note. Possible PCSystemType values

Value System Type
0 Unspecified
1 Desktop
2 Mobile
3 Workstation
4 Enterprise Server
5 Small Office and Home Office (SOHO) Server
6 Appliance PC
7 Performance Server
8 Maximum

Each of these queries has its advantages and disadvantages. In theory, the most optimal one should be the filtration by PCSystemType value, but this class appeared only in Vista, and we have many computers running the obsolete Windows XP, which won’t be filtered using this queries.

A WMI queries to determine ChassisTypes, being a part of Win32_SystemEnclosure class has seemed more interesting:

WMI-Explorer ChassisTypes

The possible values of ChassisTypes are given in the table below.

ChassisTypes Value System Type
1 Other
2 Unknown
3 Desktop (including virtual machines)
4 Low Profile Desktop
5 Pizza Box
6 Mini Tower
7 Tower
8 Portable
9 Laptop
10 Notebook
11 Hand Held
12 Docking Station
13 All in One
14 Sub Notebook
15 Space-Saving
16 Lunch Box
17 Main System Chassis
18 Expansion Chassis
19 Sub Chassis
20 Bus Expansion Chassis
21 Peripheral Chassis
22 Storage Chassis
23 Rack Mount Chassis
24 Sealed-Case PC

Thus, the following Chassis Types are typical to:

  • laptops: 8 , 9, 10, 11, 12, 14, 18, 21
  • desktops: 3, 4, 5, 6, 7, 15, 16
  • servers: 17,23

The final version of a WMI filter looks like this:

select * from Win32_SystemEnclosure where ChassisTypes = "8" or ChassisTypes = "9" or ChassisTypes = "10" or ChassisTypes = "11" or ChassisTypes = "12" or ChassisTypes = "14" or ChassisTypes = "18" or ChassisTypes = "21"

This WMI filter can be easily transformed into an SCCM query, which allows to build a collection with all laptops in the network.

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")

sccm query to find laptops

Finally, to provide a comprehensive view about the quantitative ratio of desktops and laptops in the network, you can make an SCCM report:

CASE ChassisTypes0
WHEN '8' THEN 'Notebooks'
WHEN '9' THEN 'Notebooks'
WHEN '10' THEN 'Notebooks'
WHEN '11' THEN 'Notebooks'
WHEN '12' THEN 'Notebooks'
WHEN '14' THEN 'Notebooks'
WHEN '18' THEN 'Notebooks'
ELSE 'Desktops'
END AS "Workstation Type", count(distinct sys.name0) as ClientCount from
v_R_System SYS ON ENC.ResourceID = SYS.ResourceID
sys.client0=1 AND sys.obsolete0=0 AND active0=1
CASE ChassisTypes0
WHEN '8' THEN 'Notebooks'
WHEN '9' THEN 'Notebooks'
WHEN '10' THEN 'Notebooks'
WHEN '11' THEN 'Notebooks'
WHEN '12' THEN 'Notebooks'
WHEN '14' THEN 'Notebooks'
WHEN '18' THEN 'Notebooks'
ELSE 'Desktops'
ORDER BY 2 desc

In our case, the proportion of desktop PCs and laptops is 2832 to 109.

sccm report with laptops / desktops countSo, we have considered how to create an SCCM collection or a GPO WMI filter that allows to select all laptops in the network using ChassisTypes attribute of SystemEnclosure class.

Related Articles