Using ADMod to import users into groups

I have been playing with using ADMod from JoeWare to import usernames into specifics groups.

I have the usernames as well as the groups that the need to be assigned to.

I could have the usernames in one file and the ad groups that the need to be assigned to in another file.

The other option is to have the username and group that the need assigned to on one line seprated by a comma.

Any good suggestions on how to do this using AdMod or should I look to code or re-code a script to do this?
wrkstatAsked:
Who is Participating?
 
deroodeConnect With a Mentor Systems AdministratorCommented:
Edit your file:

At the beginning of each line add "DSquery user domainroot -name "
Replace "," with  "| dsmod group "
At the end of each line add ",OU=GROUPS,DC=domain,DC=LOCAL" -addmbr" (depending on you domain name and the location of the groups

So the first line reads:

DSquery user domainroot -name doej | dsmod group accounting,OU=GROUPS,DC=domain,DC=LOCAL -addmbr
0
 
deroodeSystems AdministratorCommented:
You could use DSMOD to do that:

DSquery user domainroot -name username | dsmod group "securitygroup,OU=GROUPS,DC=domain,DC=LOCAL" -addmbr

If you have the users and groups in a comma separated file you can use any editor (or excel) to add the DSQuery and dsmod parts
0
 
wrkstatAuthor Commented:
I have a file with the usernames (not DN) and the groups that each of these users needs to be put in.

Something that looks like this -


doej,accounting
wiser,accounting
smithr,kitchen

etc...

What would be the best way to import this into AD?

0
 
wrkstatConnect With a Mentor Author Commented:
I could not get that working. Had to modify the command to look like this -

dsquery user -samid doej|dsmod group "cn=accounting-W,OU=Groups,DC=domain,DC=com" -addmbr

This seems to work when changed as above.

0
 
wrkstatAuthor Commented:
The command specified by deroode didn't work, but after working with his concept I was able to get the command working after changing a few things to get the format right.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.