Jump to content


  • 0
Vicmon

Collection based on Users in OU

Question

Trying to create a collection that will automatically query and update based on users in an OU. Would like to set it up so we can add more queries that will populate users from other OUs as well. Will help with software distribution after training. as well as when users are moved base on new job position.

 

Thank you for any help! B)

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0

1. Create a new collection.

2. On the Membership Rules page, enable "Update this collection on a schedule" and configure your schedule, and then enable "Dynamically add new resource" (if the option is available)

3. Click on the new Query Rule button and give the query a name, choose User Resource as the resource class, and then click on Edit Query Statement.

4. Click on the Criteria tab and then click on the Show Query Language button.

5. Type the following query into the Query Statement field:

 

select SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain from SMS_R_User where SMS_R_User.UserOUName = "<YOUR DOMAIN>/<YOUR OU>"

 

Make sure to replace <YOUR DOMAIN> with the NetBIOS name of your domain and <YOUR OU> with the name of your OU.

If that doesn't work, verify the name of the OU by right-clicking on the user in SCCM and looking at the value of the User Container Name[0] property.

The value of User Container Name[0] should take the place of <YOUR DOMAIN>/<YOUR OU> in the query.

 

Also, keep in mind that the Active Directory User Discovery plays a part in how often this collection will be updated, not just the collection update schedule.

  • Like 1

Share this post


Link to post
Share on other sites

  • 0

Hey guys, does anyone know or have had any luck using a query with multiple OU's?

I want to add two OU's in the same query to add the computers from each of the seperate OU's.

 

I tired adding the system resourse and then the system resource OU etc as usual (e.g. for OU 1), and then added another OU (e.g. OU2) but it showed 0 computers. For the mean time I have had to deploy the same things to seperate OU collections but I would like to keep it down to just one :)

 

 

Any ideas?

Share this post


Link to post
Share on other sites

  • 0

So here is the second part to that query.

 

Does anyone know how to get that same query to remove computers that are no longer in that OU? It seems to add them just fine bu when you move a computer out of that OU an into another, they seem to stick in the collection and get added to the new collection as well.

Share this post


Link to post
Share on other sites

  • 0

Does anyone know how to get that same query to remove computers that are no longer in that OU

 

It should do this automatically hence the query rule....give it time, run update membership on collection or run system discovery from discovery methods if in a panic to see it happen..

 

Rocket

Share this post


Link to post
Share on other sites

  • 0

Just change the update schedule of all your collections to a more aggressive time(15mins or use delta discovery on the collections instead of full update).....this will automate it for you and speed up your slow moving software if you are continuously moving systems from OU to OU in AD!

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
Answer this question...

×   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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.