Here is an ASP page I made to do this. Modify as you see fit.
<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript">
Sub cmdCreate_OnClick
'Declare and assign variable values
Dim Uname, Pswrd, Fname, Sname, Cell, Tel, JTitle, Dept, Comp, Office, Empno, Empnu,Ou, List, Checkit, AccCon, Combined
Empnu = UCase(frmUserc.txtEmpno.va
lue)
frmUserc.txtEmpno.value = Empnu
Uname = frmUserc.txtEmpno.value
Pswrd = frmUserc.txtEmpno.value
Fname = frmUserc.txtFname.Value
Sname = frmUserc.txtSname.Value
Cell = frmUserc.txtCell.value
Tel = frmUserc.txtTel.value
JTitle = frmUserc.txttitle.value
Dept = frmUserc.txtDept.value
Comp = frmUserc.txtComp.value
Office = frmUserc.cboUnit.value
Empno = (frmUserc.txtEmpno.Value)
AccCon = 544
'Values
'512 - Enable Account
'514 - Disable account
'544 - Account Enabled - Require user to change password at first logon
'66048 - Password never expires
'262656 - Smart Card Logon Required
'Format checking
Checkit = frmUserc.txtFname.Value
If Len(Checkit) = 0 Then
Checkit = MsgBox("You must enter employee's name.", vbCritical, "Account Creation Error")
frmUserc.txtFname.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtSname.Value
If Len(Checkit) = 0 Then
Checkit = MsgBox("You must enter employee's surname.", vbCritical, "Account Creation Error")
frmUserc.txtSname.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtEmpno.Value
If Len(Checkit) <> 8 Then
Checkit = MsgBox ("You must enter an employee number.", vbCritical, "Account Creation Error")
frmUserc.txtEmpno.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtEmpno.Value
If Isnumeric(Right(Checkit,7)
) = False Then
Checkit = MsgBox ("Employee number must contain 7 numeric values.", vbCritical, "Account Creation Error")
frmUserc.txtEmpno.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtTel.Value
If Isnumeric (Checkit) = False OR Len(Checkit) <> 10 Then
Checkit = MsgBox ("Telphone number must be numeric and contain 10 digits.", vbCritical, "Account Creation Error")
frmUserc.txtTel.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtCell.Value
If Isnumeric (Checkit) = False OR Len(Checkit) <> 10 Then
Checkit = MsgBox ("Cell number must be numeric and contain 10 digits.", vbCritical, "Account Creation Error")
frmUserc.txtCell.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtComp.Value
If Len(Checkit) = 0 Then
Checkit = MsgBox ("Please enter a company name.", vbCritical, "Account Creation Error")
frmUserc.txtComp.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtDept.Value
If Len(Checkit) = 0 Then
Checkit = MsgBox ("Please enter a department name.", vbCritical, "Account Creation Error")
frmUserc.txtDept.focus
Exit Sub
Else
End If
Checkit = frmUserc.txtTitle.Value
If Len(Checkit) = 0 Then
Checkit = MsgBox ("Please enter a job title.", vbCritical, "Account Creation Error")
frmUserc.txtTitle.focus
Exit Sub
Else
End If
Checkit = frmUserc.cboUnit.Value
If Checkit = "" OR Checkit = "nill" Then
Checkit = MsgBox ("Please select a valid office.", vbCritical, "Region Check")
frmUserc.cboUnit.focus
Exit Sub
End If
'ou name
Ou = frmUserc.cboUnit.value
'OU troubleshooting line : msgbox("LDAP://"& Ou &",dc=YOURDOMAIN,dc=COM")
'Office name
List = frmUserc.cboUnit.selectedI
ndex
Office = frmUserc.cboUnit.options(L
ist).text
'Join first name and surname
Combined = (""& Fname &" "& Sname &"")
'Write to the AD
Set objOU = GetObject("LDAP://"& Ou &",dc=YOURDOMAIN,dc=COM")
Set objUser = objOU.Create("User", "cn= "& Combined &"")
'If all is unique write data
objUser.Put "sAMAccountName", ""& Uname &""
objUser.Put "givenname", ""& Fname &""
objUser.Put "sn", ""& Sname &""
objUser.Put "displayname", ""& Fname &" "& Sname &""
objUser.Put "employeenumber", ""& Empno &""
objUser.Put "telephonenumber", ""& Tel &""
objUser.Put "physicalDeliveryOfficeNam
e", ""& Office &""
objUser.Put "mobile", ""& Cell &""
objUser.Put "title", ""& JTitle &""
objUser.Put "department", ""& Dept &""
objUser.Put "company", ""& Comp &""
objUser.Put "userPrincipalName", ""& UName &"@wesbank.co.za"
objUser.Put "userpassword", ""& Empno &""
'objUser.Put "userAccountControl", AccCon REMOVE
objUser.SetInfo
'On completion
Checkit = MsgBox("Account for "& Fname &" "& Sname &" successfully created. Username: "& Empno &" - Password: "& Empno &". User will be prompted to change password at first logon.", vbInformation,"Account Created")
'Clear on completion
frmUserc.txtEmpno.value = empty
frmUserc.txtEmpno.value = empty
frmUserc.txtFname.value = empty
frmUserc.txtSname.value = empty
frmUserc.txtCell.value = empty
frmUserc.txtTel.value = empty
frmUserc.txttitle.value = empty
frmUserc.txtDept.value = empty
frmUserc.txtComp.value = empty
frmUserc.cboUnit.value = empty
If frmUserc.txtEmpno.value <> empty Then
Checkit = msgbox("Account already exists.", vbCritical, "Creation Error")
End if
End Sub
</SCRIPT>
</HEAD>
<BODY>
<CENTER>
<TABLE CELLSPACING=0>
<TD colSpan=2 BGCOLOR=#009999 HEIGHT=60 WIDTH=60>
<TD><IMG height=46 src="
http://l.yimg.com/a/i/mntl/ww/events/p.gif"
width=109></TD>
<TR>
<TD colspan=2 BGCOLOR=#009999 HEIGHT=15 WIDTH=56>
<TD BGCOLOR=#009999 HEIGHT=15 WIDTH=600>
<TR>
<TD colspan=3><B><FONT color=#009999 FONT SIZE=5>New User</B>
</TABLE>
<TABLE WIDTH=660 CELLSPACING=1>
<DIV>
<TD BGCOLOR=#009999 width=25>
<TD BGCOLOR=#009999 width=25>
</DIV>
<TR>
<TD COLSPAN=3><FONT color=#009999><B>Please provide the requested information:</B>
<TR>
<TD COLSPAN=5><I><FONT Size = 2 FONT color=#009999>All feilds are required.</I></P>
<FORM NAME="frmUserc">
<TABLE>
<TR>
<TD><B><FONT color=#009999>Name:</B></TD>
<TD><INPUT TYPE="Text" NAME="txtFname" SIZE=15></TD>
<TD><B><FONT color=#009999>Surname:</B></TD
>
<TD><INPUT TYPE="Text" NAME="txtSname" SIZE=15></TD>
</TR>
<TR>
<TD><B><FONT color=#009999>Employee Number:</B></TD>
<TD><INPUT TYPE="Text" NAME="txtEmpno" SIZE=15></TD>
</TR>
<TR>
<TD><B><FONT color=#009999>Telphone Number:</B></TD>
<TD><INPUT TYPE="Text" NAME="txtTel" SIZE=15></TD>
<TD><B><FONT color=#009999>Cell Number:</B></TD>
<TD><INPUT TYPE="Text" NAME="txtCell" SIZE=15></TD>
</TR>
<TR>
<TD><B><FONT color=#009999>Company:</B></TD
>
<TD><INPUT TYPE="Text" NAME="txtComp" SIZE=15></TD>
<TD><B><FONT color=#009999>Department:</B
></TD>
<TD><INPUT TYPE="Text" NAME="txtDept" SIZE=15></TD>
</TR>
<TD><B><FONT color=#009999>Job Title:</B></TD>
<TD><INPUT TYPE="Text" NAME="txtTitle" SIZE=15></TD>
</TR>
<TD><B><FONT color=#009999>Region\Office
:<TD><select NAME=cboUnit
<option value="">
<option value="nill">-- Select Office --
<option value="OU=ouname,DC=DOMAIN
,DC=com">ou
one user account will go in
</select><br>
</TABLE>
<BR>
<INPUT TYPE="Button" NAME="cmdCreate" VALUE="Create">
</FORM>
</BODY>
</HTML>