Group Membership Via Ou

CircularSaw

New member
Joined
Mar 31, 2010
Messages
2
Hi all,

New to this forum - love the layout!

I have a question - I'm setting up my first corporate domain and I'd like to add users to Groups via the OU they are in. I can't quite work out how to do this although I'm fairly sure it can be done.

I'm on (obviously) Server 2008 (FFL/DFL 2008).

Could anyone offer any quick pointers?

Many thanks!
 
Using dsquery and dsmod may be the easiest way, if you are talking about doing this on a continuing basis and not just once.

A command like:
dsquery user "" | dsmod group "" -addmbr

For example:
dsquery user "ou=Sales,ou=West,dc=MyDomain,dc=com" will return a list of users in the West > Sales OU of mydomain.com

Then pipe that list into the dsmod command:
DSMOD group "CN=Testing,OU=testou,DC=MyDomain,DC=com" -addmbr which will add all the users returned in the first part to the Testing group in the testou OU.


If you want them to be added going forward, you'd have to put it in a script and schedule it to run every day or week or however often you want to keep them up to date.

If they had query-based security groups in Windows, it would be easier to do.


If you only need to do this once while you are setting up the domain, you can use the commands above, or you can just highlight everything in the OU and add them to the groups you want.
 
Back
Top