Windows 2016
Sponsored Link

Active Directory : Add Users with a Batch2017/02/07

If there are many user accounts you must add on AD, then Add them with a Batch. This is an example.
[1] Create a text file and write users you'd like to add on AD with full name like follows.
[2] Create a batch file like follows (it's an example, modify if you want).
The batch loads the user-list file created in [1] and add them into OU:Hiroshima-OU:Development01.
The users's password are set temporarily as their full name and they must change it for initial logon.
@echo off
set USERLIST=users.txt
set OU=OU=Development01,OU=Hiroshima
set DC=DC=srv,DC=world
for /f "tokens=1,2" %%i in (%USERLIST%) do (
dsadd user CN=%%i,%OU%,%DC% -pwd %%i%%j -mustchpwd yes ^
-ln %%i -fn %%j -email -display "%%i %%j"
[3] The default password policy denies passwords which username is included, so change policy temporarily (after adding users, Do not forget to go back to default policy to protect trivial password).
Run [Tools] - [Group Policy Management].
[4] Right-Click [Default Domain Policy] and select [edit...].
[5] Open [Password Policy] like follows.
[6] Open [Password must meetcomplexity requirements] and turn to Disabled temporarily.
[7] After few minites later, Run a batch created in [2] to add Users. After finishing Users, Do not forget to turn to Enabled for [Password must meetcomplexity requirements].
[8] User Accounts are just added with a batch.
Matched Content