Thursday, February 7, 2008

Create users with a script and dsadd command

Domain: VAN.COM
Organizational Unit: Students

I will use the MS Excel spreadsheet to create the script.

Before you input the option such as -upn, format the cell as TEXT.

ROW one

CELL A1:
dsadd user

CELL B1:
="CN=" & D1 & " " & F1 & ",OU=Students,DC=VAN,DC=COM"

CELL C1:
-fn

CELL D1:

CELL E1:
-ln

CELL F1:

CELL G1:
-display

CELL H1:
=D1 & "," & F1

CELL I1:
-samid

CELL J1:
=LEFT(D1,1) & F1

CELL K1:
-upn

CELL L1:
=D1 & "." & F1 & "@van.com"

CELL M1:
-pwd

CELL N1:
=LOWER(D1)

=====
Copy the row 1 to row 2, 3, ...

input some names: D1, F1; D2,F2;D3,F3

====
Save the worksheet as a MS-DOS Text format with .bat extension.

Copy the batch file to domain controller and run it. All users will be created.

===