Close Menu
    Facebook X (Twitter) Instagram
    Thursday, October 22
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»Collections»Collections based on the OU

    Collections based on the OU

    Eswar KonetiBy Eswar KonetiNovember 5, 20091 Min Read Collections
    Share
    Facebook Twitter LinkedIn Reddit

    If you are looking for a collection to query all the machines only from a particular OU not the SUB OU .Let say ,I have Top OU called Workstations\comp(120 systems) in eskon.net domain and in turn it has 3 sub OU’s OU1(10 systems),OU2(20 systems),OU3(49 systems).

    Here is the simple query to get machines only from TOP OU called workstations.

    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.systemouname = “eskon.net/workstations/comp” /*find all machines in that OU (but also finds machines in subOUs */
           AND sms_r_system.resourceID NOT IN (SELECT resourceID FROM sms_r_system where systemouname LIKE “eskon.net/workstations/comp/%”) /*remove records for machines in subOUs*/

    The above collection should display only machines that are present in comp OU not from the SUB OU’s (like OU1,OU2,OU3).

    Collections
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM report list collections with no deployments

    December 5, 2022

    Investigating SCCM Client Policy Request and Communication Status with a Collection Specific Report

    October 15, 2022

    SCCM Collection for AAD joined devices (co-managed)

    February 5, 2021

    2 Comments

    1. Roel Janssens on November 25, 2013 7:41 PM

      Thanks for sharing, solves my problem! It was indeed the NOT IN /% at the end of the second query.

      Reply
      • Eswar Koneti on November 27, 2013 7:32 AM

        Thanks 🙂

        Reply
    Leave A Reply Cancel Reply

    Support

    Awards

    Archives
    • Home

    © Copyright 2009-2025 Eswar Koneti, All rights reserved.

    Type above and press Enter to search. Press Esc to cancel.