Jump to content


Super_Noob

Collection from AD query but need to exclude sub OU in query

Recommended Posts

Hi all, I'm stumped by a collection I need to make. I jumped into an SCCM role and unfortunately I do not control the AD structure. I need to create a collection of all of the companies workstations under an AD OU Workstations. The caveat is that under that OU is a sub OU for production machines that I do not want in this collection. I have a query created collection and am pulling all of the Workstations OU and I also have a collection of the sub OU. Can anyone advise me on the syntax to create a new collection with the proper exclusion? Here is an example of what I am trying but haven't gotten correct yet:

 

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 = "DOMAIN.NET/WORKSTATIONS/WORKSTATIONS (SP2 REQUIRED)" not in "DOMAIN.NET/WORKSTATIONS/WORKSTATIONS (SP2 REQUIRED)/PRODUCTIONS"

 

 

I appreciate any guidance!

 

Thanks,

Rob

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...