Ok, tried that but still getting the same results. Should I try to put parentheses around the or staments group?
Diana
Main Topics
Browse All TopicsHey all!
Got a bit of an SCCM conundrum for the elite technorati here:
Is it possible to exclude an Active directory sub-OU (nested?) from a collectin in SCCM? I have been trying to do it via the collection query (see below), but everything I try still has the sub-OU machines listed in the collection. In contrast, if I run the reverse of the last part of the query by itself, I get he list of the machines I want excluded. Any ideas? Thanks bunches!
Diana
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The trick for SCCM collectin exclusions is a second select statement.
e.g.
select SMS_R_SYSTEM.ResourceID,
SMS_R_SYSTEM.ResourceType,
SMS_R_SYSTEM.Name,
SMS_R_SYSTEM.SMSUniqueIden
SMS_R_SYSTEM.ResourceDomai
SMS_R_SYSTEM.Client
from SMS_R_System
where SMS_R_System.SystemOUName like "abc.xyz.com/alphaOU"
or SMS_R_System.IPAddresses like "10.1.%"
or SMS_R_System.IPAddresses like "10.2.%"
or SMS_R_System.IPAddresses like "10.3.%"
or SMS_R_System.IPAddresses like "10.15.%"
and SMS_R_System.ResourceID Not In (Select ResourceID from SMS_R_System Where SystemOUName like "abc.xyz.com/alphaOU/betaO
Jon,
Thank you for the suggestion and sorry for the delay. I was trying to do that last night and hopefully this points me in the right direction, although after trying it, I am getting getting a blank result. If I run the subquery you have listed, Iit returns a list of the machines I want excluded, the way it is supposed to work. However, when I run the full query, it is blank; heck, when I run the last where statement by itself (without the or statements there in the way) against the current collection, it comes up blank. I am beginning to think SCCM or SQL (WQL?) does not want to allow it to work.
Diana
Hi Diana,
I did some experimenting, and this works find for me, it includes all resources in the OU called Workstations, and excludes the ones in Workstations\Sub-OU. (BTW I note that your excluded OU in the query above as a backslash instead of a foward slash new the 'excludedOU')
select SMS_R_SYSTEM.ResourceID,SM
Business Accounts
Answer for Membership
by: demazterPosted on 2009-08-12 at 13:39:21ID: 25082691
change this from a like to an = where SMS_R_System.SystemOUName like "abc.xyz.com/alphaOU"
Like is if that string is contained in the OUname and it will be as the other OU is a sub OU of this one.