WQL collection queries

Find all workstations and leave out servers

A WQL collection query that returns every Windows workstation and leaves out servers. One word changes it into an all servers query.

LanguageWQL
What it does to the systemReads only. It changes nothing.

This query builds a device collection of every Windows workstation. It leaves servers out.

It reads the operating system name from discovery data. It works even before a client sends hardware inventory.

WQL
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
where SMS_R_System.OperatingSystemNameandVersion like "%Workstation%"

How to use it

  1. In the console, open Assets and Compliance, then Device Collections.
  2. Open the collection properties. On Membership Rules, select Add Rule, then Query Rule.
  3. Select Edit Query Statement, then Show Query Language. Paste the query.
  4. Select OK, then update the collection membership.

Good to know

  • For all servers, change "%Workstation%" to "%Server%".
  • The value looks like Microsoft Windows NT Workstation 10.0 or Microsoft Windows NT Server 10.0.
  • Records with an empty operating system name match neither query. Check those by hand.
workstations servers OperatingSystemNameandVersion SMS_R_System
✉

Get new articles in your inbox

SCCM guides, AI tools, automation tips — sent when published. No spam.