Where is a collection included in ?

It’s time for my first public blog post. What should it be about ??
It will be about collections in ConfigMgr 2012.
I got a question from a customer: How can I find out which other collections this collection is used in ?
It’s very easy to see if there is collections included by looking in the Referenced Collections. Open every collection to see the name is time consuming. A script is needed :)


After some research I find this blog.

But I wanted to have it a little bit different. PowerShell is not my strongest skill, but I have a college (Simon Wåhlin) who is VERY skilled. He gladly helped me and the result is the following:

Here is a video recording from running the script:

Have a nice day

2 thoughts on “Where is a collection included in ?

  1. Nathan Hager

    Alternatively you could run the following against your SCCM database:
    SELECT COL.Name AS ‘Collection Name’
    ,CASE (CR.RuleType)
    WHEN ’3′ THEN ‘Include’
    WHEN ’4′ THEN ‘Exclude’
    WHEN ’2′ THEN ‘Query’
    WHEN ’1′ THEN ‘Direct’
    END AS ‘Rule Type’
    ,CR.ReferencedCollectionID AS ‘Referenced Collection ID’
    ,CR.QueryName AS ‘Referenced Collection Name’
    FROM v_Collection COL
    JOIN Collection_Rules CR ON COL.CollID = CR.CollectionID
    WHERE CR.RuleType IN (’3′, ’4′)

    Sorry if the format got all janky. I’m not great with using the HTML tags. You could also turn this into a nice report with a variable for the collection ID or name.


Leave a Reply to Matthew Hayward Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">