Jump to content




Vicmon

Collection based on Users in OU



Recommended Posts

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


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

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

Is this in the same query?

 

You can add a second seperate query to the collection, in fact you could add as many seperate queries to a collection as you need instead of trying to have all in the one query!

Share this post


Link to post
Share on other sites

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

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

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

 

Yeah you were right... I keep forgetting its "SMS" Slow Moving Software.

Share this post


Link to post
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×