SCCM Query Active Directory: Finding Devices in a Specific OU

Querying Configuration Manager Devices by Active Directory OU If you need to build a Configuration Manager collection or report scoped to a particular Active Directory organisational unit — say, targeting only machines in a specific site or department’s OU — the discovery data includes the OU path, so it’s a straightforward WQL query. select SMS_R_SYSTEM.Name, […]

SCCM Query For Devices In A Specific Active Directory Organisational

Querying Configuration Manager Devices by Active Directory OU

If you need to build a Configuration Manager collection or report scoped to a particular Active Directory organisational unit — say, targeting only machines in a specific site or department’s OU — the discovery data includes the OU path, so it’s a straightforward WQL query.
select SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SystemOUName from SMS_R_System where SMS_R_System.SystemOUName = "OU=Workstations,OU=London,DC=contoso,DC=com"
SystemOUName is populated by AD System Discovery, so make sure that discovery method is enabled and has run recently, otherwise this field may be empty for machines that haven’t been re-discovered since being moved between OUs. If you want to catch objects in a nested sub-OU as well as the parent, use a like comparison with a wildcard instead of an exact match:
select SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SystemOUName from SMS_R_System where SMS_R_System.SystemOUName like "%OU=London,DC=contoso,DC=com"
Save either query and use it directly as the membership rule for a device collection if you want it to update automatically as machines move in and out of the OU.

Still Current on Configuration Manager 2603 (Updated for 2026)

This query still works unchanged on the current release (Configuration Manager 2603) — SystemOUName is still populated by AD System Discovery in exactly the same way. One thing worth double-checking if the query comes back empty: AD System Discovery only refreshes OU data on its configured polling interval, so a machine moved between OUs recently may still show its old OU path until the next discovery cycle runs.

Resources

🛠️

Gear We Recommend

Testing configs is easier with a dedicated admin machine set up right. Here’s the kit we use.

Browse our Windows Admin Toolkit picks on Amazon

As an Amazon Associate, TechyGeeksHome earns from qualifying purchases.


Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.

3 thoughts on “SCCM Query Active Directory: Finding Devices in a Specific OU

Comments are closed.