Add users from an OU to a group, with users already belonging to
Posted on 2007-10-03
I cant find the correct way to add to a security AD Group all the users belonging to an OU. Specifically I encounter a problem when some of these users are already members of the group. I've tried the next syntax:
dsquery * "ou=ou,dc=domain,dc=com" -filter "(objectClass=user)" -limit 1000 | dsmod group "CN=group-name,ou=groups,dc=domain,dc=com" -c -addmbr
But the command exits with an error telling me that The user is already member of the group, and then exits with no changes made to the group.