Creating Multiple Users in Active Directory

August 26, 2009

- Paste the below given script in Notepad
- Save it with .bat (Windows Batch File) file

@echo off
cls
echo Creating Accounts
echo ------------------
for /f "tokens=1-3" %%A in (userlist.txt) do (dsadd user "CN=%%A,ou=Network,dc=mailserver,dc=com" -fn %%B -ln %%C -display "%%B %%C" -upn %%A@thenguyen.local -pwd Passw0rd1 -mustchpwd No -disabled no)
echo ------------------
pause

ou -> Organization Unit (given as “Network” in the script, replace it with your Organization Unit name)
dc -> Domain Controller (given as “mailserver” in the script, replace it with your Domain Controller name, donot chnage the value dc=com)

Create a file with name “userlist.txt” and save all the user details in the below mentioned format.

raju    Raju    Rao
kalyan  Chakra  Naidu
chiru   Chiru   Reddy

First Column -> User Name
Second Column -> First Name
Thirm Column -> Last Name

Place both the batch and userlist.txt files in same folder.
Run the batch file. The users mentioned in userlist.txt will be created.

Note: User must have Administrator privilages to run this batch.

Share and Enjoy:
  • Twitter
  • Google Buzz
  • DZone
  • Digg
  • Reddit
  • Diigo
  • StumbleUpon
  • del.icio.us
  • Yahoo! Buzz
  • Google Bookmarks
  • LinkedIn
  • Mixx
  • email
  • PDF
  • Add to favorites

tags:
posted in Windows Admin by suresh

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org