Close Menu
    Facebook X (Twitter) Instagram
    Saturday, October 11
    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 05, 11:45 am1 Min Read Collections 210 Views
    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 05, 12:04 pm

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

    October 15, 11:22 pm

    SCCM Collection for AAD joined devices (co-managed)

    February 05, 11:34 pm

    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 ReplyCancel reply

    This site uses Akismet to reduce spam. Learn how your comment data is processed.

    Sign Up

    Get email notifications for new posts.

    Author

    I’m Eswar Koneti ,a tech enthusiast, security advocate, and your guide to Microsoft Intune and Modern Device Management. My goal? To turn complex tech into actionable insights for a streamlined management experience. Let’s navigate this journey together!

    Support

    Awards

    Archives

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

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