Compartir a través de


How To: Adding Lots of Users To AD To Setup Testing Environments

Syed Aslam Basha here. I am a tester on the Information Security Tools team.

To carryout performance testing for one of our projects I need to have thousands of users for self hosted domain controller and active directory(AD). It is next to impossible to create thousands of users manually. Interestingly I found an easy way of creating thousands of users using dsadd command so I thought I would share it.

Launch notepad and copy paste the below command and save it as Users.bat. Launch command prompt (as administrator) and run the Users.bat.

dsadd user"cn=syedaslambasha,OU=User Accounts,dc=suared2,dc=suacorp,dc=selfhost,dc=corp,dc=microsoft,dc=com" -display Syed Aslam Basha -pwd Microsoft~1 -email syedtest@microsoft.com -mustchpwd no -canchpwd no -pwdneverexpires yes -disabled no

Dsadd command lets you to add objects like computers, contacts, groups, organizational units (OUs), quotas, users to AD.

 dsadd succeeded:

Like wise you can use dsmod to modify existing user information as shown below.

dsmod user "CN=syedaslambasha,OU=User Accounts,DC=suared2,DC=suacorp,DC=selfhost,DC=corp,DC=microsoft,DC=com" -mgr "CN=sua manager,OU=User Accounts,DC=suared2,DC=suacorp,DC=selfhost,DC=corp,DC=microsoft,DC=com

dsmod succeeded:

Modify the above script parameters appropriately to create user successfully!

- Syed