SCCM restrict collection membership

The snippet allows one to create a collection containing objects that are in some OUs but NOT IN another collection

I found part of this snippet here: http://myitforum.com/cs2/blogs/rbennett806/pages/collection-queries.aspx

SELECT
srsys.ResourceID,
srsys.ResourceType,
srsys.Name,
srsys.SMSUniqueIdentifier,
srsys.ResourceDomainORWorkgroup,
srsys.Client
FROM
SMS_R_System srsys
WHERE
(
srsys.SystemOUName = "NINET.ORG/PRIMARY"
OR
srsys.SystemOUName = "NINET.ORG/OSD"
)
AND
srsys.ResourceID
NOT IN
(
SELECT ResourceID
FROM SMS_FullCollectionMembership
WHERE CollectionID = "XXXXXXXX"
)

Leave a Reply

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

*

This blog is kept spam free by WP-SpamFree.