Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to create 100 users just for test purposes of my Exchange Server.

Is there a way to batch do this using random names, etc?

share|improve this question
    
What version of Exchange? –  Ben Pilbrow Dec 6 '10 at 13:23
    
Exchange Server 2003. –  Sergio Tapia Dec 6 '10 at 13:29
add comment

6 Answers 6

up vote 3 down vote accepted

Here is a script that I made to use dsadd. I have a one line batch file that imports all of my new users every year:

(There might be a better way to display this, but I haven't had coffee yet.)

for /F "tokens=1,2,3,4 delims=," %%i in (freshmen09.csv) do dsadd user "cn=%%j %%i,ou=2013,ou=students,dc=[domain],dc=org" -samid %%k -pwd "%%l" -upn %%k@[domain].org -fn "%%j" -ln "%%i" -display "%%j %%i" -memberof "cn=GL 2013,ou=2013,ou=students,dc=[domain],dc=org" -disabled no -mustchpwd yes -hmdrv U: -hmdir "\\[network home directory]\2013\%%k"

This take 4 columns from a CSV file: Last Name, First Name, Username, Password

  • It creates a user for each row in the file,
  • Puts them into the desired OU,
  • Sets the password,
  • Adds them as a member of a group,
  • Enforces that the password must be changed when the user first logs in,
  • Sets the home directory to the appropriate place on our network share.

I have tried to get this to create email addresses automatically, but I have had inconsistent results. It is easy enough to just select all the users at once in Active Directory Users and Computers and setup Exchange Mailbox from there. Very simple, and much easier than figuring that part out with DSADD.

DSADD has many other parameters as well. You can basically make it set any user properties that you want. Simple, easy, and fast.

One failure: Username collisions need to be handled manually. We occasionally have students with names like James Smith and Jonathon Smith. If you have a system to prevent collisions ahead of time, perfect. If not, I recommend redirecting the output of the bat file to a text file and just search for "Fail" in the results.

freshmen09.bat > freshmen09_output.txt

(There is likely a much better way to do this part...)

share|improve this answer
add comment

If you have a Windows Server 2008 R2 Domain Controller available, you can run the following PowerShell script to create some dummy users. You'll still have to use Active Directory Users and Computers to mailbox enable these users, but you can select all the users and do it in bulk.

You can change the number of users created, and the password on the accounts as well. Note that the password must comply with any password requirements (complexity, length etc.) in effect.

Save as NewUsers.ps1 and run from the Active Directory Module for Windows PowerShell.

For($i = 0; $i -lt 100; $i++)
{
    $UserNumber = $i + 1

    New-ADUser User$UserNumber -AccountPassword (ConvertTo-SecureString -AsPlainText -Force -String "P#$$w0rd") -Enabled $True
}
share|improve this answer
add comment

Check the script here: http://blogs.technet.com/b/keithcombs/archive/2008/11/26/filling-up-active-directory-with-some-test-data.aspx

Make sure your internal domain is CONTOSO.COM, or else change the script. You will have to create mailboxes for all the users afterwards, but that is pretty easy to do in bulk.

share|improve this answer
add comment

On the command prompt, look at "dsadd":

http://technet.microsoft.com/en-us/library/cc731279(v=WS.10).aspx

or "net user":

http://support.microsoft.com/kb/251394

You can use excel or notepad etc to prepare a list of commands to paste into a command prompt, or make a batch file.

share|improve this answer
    
It says that applies to Windows Server 2008. Will this work in Windows Server 2003, what I'm using? –  Sergio Tapia Dec 6 '10 at 13:31
    
My bad linking! Yes it will :) –  simon Dec 6 '10 at 13:42
add comment

This could help you in an easy way: http://testools.blogspot.com/2013/01/how-to-create-several-users-in-active.html

This is better if you want to have specific names for each user, different than user1, user2, etc.

share|improve this answer
add comment

Or we can use this command dsadd user here is one article which is talking about who to create user and folders.

set FirstName=Graice
set LastName=tsai
set LogonName=graice
set pass=welcome
dsadd user ”CN=%LogonName%, ou=FTPUsers, dc=yourDCname,dc=com” -pwd %pass% -pwdneverexpires yes -samid %LogonName% -upn %LogonName% -ln %LastName% -fn %FirstName%
dsmod user ”CN=%LogonName%, ou=FTPUsers, dc=yourDCname,dc=com” -disabled no
dsmod group ”CN=FTP Users, ou=FTPUsers, dc=yourDCname,dc=com” -addmbr ”cn=%LogonName%, ou=FTPUsers, DC=yourDCname, DC=com”
share|improve this answer
add comment

Your Answer

 
discard

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