Using ADMod to import users into groups

Posted on 2011-04-18
Last Modified: 2012-05-11
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?
Question by:wrkstat
    LVL 19

    Expert Comment

    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

    Author Comment

    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 -



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

    LVL 19

    Accepted Solution

    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

    Assisted Solution

    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.


    Author Closing Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Do you have users whose passwords are expiring and they are constantly calling you?  Well I sure did and needed a way to put an end to this.  We have a lot of remote users which would not be notified that their passwords were expiring since they wer…
    INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now