Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a large number of users and I know what their password is already. I also know what their profile path is. What is the best/most efficient way to add them all at once?


share|improve this question
up vote 3 down vote accepted

Personally, I'd probably go for a script to use dsadd.exe (assuming you have a Windows 2003 Server or newer computer handy-- dsadd.exe was added in W2K3):

Assuming the list of user account names is in a text file "users.txt", with the format of "username|password" you could do:

SET DEST_DN=OU=Outside,OU=Sales,DC=ad,DC=example,DC=com
FOR /F "delims=| tokens=1*" %%i IN (users.txt) DO dsadd user "CN=%%i,%DEST_DN%" -samid "%%i" -pwd "%%j" -profile "%PROFILE_PATH%\%%i"

You could easily add more columns to that users.txt file and use some of the various other arguments of "dsadd" to add more attributes to the users (first name, last name, UPN, etc).

Change "PROFILE_PATH" and "DEST_DN", obviously, to fit your needs. The script is assuming that the profile directories are subdirectories of the same path.

You'll need to know the distinguished name (DN) of the container where you want to put the user accounts. It's actually pretty easy to figure that out. For a domain as follows:

   |-- [OU] Sales
  ...   |
        |-- [OU] Outside

The DN for the "Outside" sub-OU of the "Sales" OU would be: OU=Outside, OU=Sales, DC=ad, DC=example, DC=com

Not too bad. The defalt "Users" container off the root of AD, BTW, isn't an OU-- it's a container, so it would be called "CN=Users" in a DN.

share|improve this answer
What is %%i is that a user? I want the profile path to be ..\PROFILE\User Name – Noah Clark Oct 1 '09 at 16:55
That's a variable substitution. The script reads in "users.txt" for usernames and passwords (into the variables %%i and %%j) and then substitutes them onto the dsadd command line. – Evan Anderson Oct 1 '09 at 18:03
C:\Users\Administrator\Desktop>■@ '■@' is not recognized as an internal or external command operable program or batch file. I get that error. – Noah Clark Oct 1 '09 at 18:59
I think there is some formating in there that I'm missing. Is there anyway to view it, I don't see it in the .bat file in notepad. – Noah Clark Oct 1 '09 at 19:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.