Close Menu
    Facebook X (Twitter) Instagram
    Saturday, October 11
    X (Twitter) LinkedIn Reddit RSS
    All about Endpoint Management
    • Home
    All about Endpoint Management
    Home»CM2012»Configmgr Report list empty collections with no query rules defined (collection clean-up)

    Configmgr Report list empty collections with no query rules defined (collection clean-up)

    Eswar KonetiBy Eswar KonetiJanuary 13, 1:14 pm2 Mins Read CM2012 5,691 Views
    Share
    Facebook Twitter LinkedIn Reddit

     

    I was looking at the console other day and found that, there were many collections created in the root folder (device collection) with 0 count. So i looked at the collection properties ,i found empty there  (No direct or query based rule).

    So i decided to write SQL query to identify the list of collections that have empty results with no query rules (Direct or query based) defined in it.

    For this query ,i have used 2 SQL views (v_Collection and v_CollectionRuleQuery ) .

    For full list of SQL views that exist in SCCM Configmgr ,please refer https://gallery.technet.microsoft.com/SCCM-Configmgr-2012-R2-SQL-5fefdd3b .

    Following is the SQL Code to identify empty collections with no query rule defined ,You can delete these collections to simplify the list of collections displayed when deploying objects as part of maintenance tasks ,unless there is a reason to be in the console.

    You can use the following code to create SSRS report as well.

    select coll.CollectionID,coll.Name,
    case when coll.CollectionType='1' then 'User' else 'Device' end as 'Collection Type'
    from v_Collection coll
    where coll.collectionid not in (select CRQ.collectionid from v_CollectionRuleQuery CRQ)
    and coll.MemberCount=0
    group by coll.CollectionID,coll.Name,coll.CollectionType

    Configuration manager Technical preview 1708 has ability to identify Applications without deployments and Empty collections as part of Management insights.  More information ,please read https://docs.microsoft.com/en-us/sccm/core/get-started/capabilities-in-technical-preview-1708#management-insights

    Hope it helps!

     

    collection cleanup CollectionRuleQuery configmgr emtpy collections maintanance tasks Management insights SCCM SQL SQL query SSRS Report
    Share. Twitter LinkedIn Email Facebook Reddit

    Related Posts

    SCCM SQL Report – Compare Installed Apps on TWO Different Computers

    July 13, 10:35 am

    Optimize Your Intune Workflow with a Powerful Browser Extension

    March 22, 10:39 am

    Migrate Microsoft 365 Updates from SCCM/MECM to Intune for Co-Managed Devices

    February 11, 9:50 pm

    1 Comment

    1. Madhu on January 18, 2018 7:07 AM

      very helpful post. thank you so much

      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.