Hi,

Here is some Italian food code but it works for me.

Every year I have to put +1400 Students to AD and this is the part of my script for the creation of the user accounts.

Code:
 		$adsDomain = GetObject("LDAP://$userOU,dc=$DomainName,dc=$Toplevel")
$adsGroup = GetObject("LDAP://cn=$Group,$GroupOU,dc=$DomainName,dc=$Toplevel")

; Gebruiker met gegevens aanmaken

$adsUser = $adsDomain.Create("user","cn=$UserName")
$adsUser.Put("SamAccountName",$UserName)
$adsUser.Put("UserPrincipalName",$UserName + "@@" + $DomainName + "." + $TopLevel)
$adsUser.SetInfo

$adsUser.AccountDisabled = False
$adsUser.IsAccountLocked = False
$adsUser.PasswordRequired = True
$adsUser.SetPassword("$PassWrd")

If $changepasswrd = 1
$adsUser.put("pwdLastSet", 0)
EndIf

$adsUser.scriptPath = "wkix32 -i " + $scriptname

If $profilename <> ""
$adsUser.profilePath = "\\" + $homeserver + "\profielen$\" + $profilename
Shell "c:\windows\system32\tsprof /update /local /profile://l01s01s02/profielen$/terminalserver $UserName"
EndIf

$adsUser.HomeDirectory = "\\" + $homeserver + "\home$\$username"
$adsUser.Put("homeDrive", $homedrive)

$adsUser.FirstName = $FirstName
$adsUser.givenName = $FirstName
$adsUser.LastName = $LastName
$adsUser.sn = $LastName
$adsUser.displayName = "$FirstName $LastName"
$adsUser.Description = $UserDiscr
$adsUser.mail = "$UserName@@$DomainName.$TopLevel"
$adsUser.initials = $initial
$adsUser.SetInfo

$adsGroup.add("LDAP://cn=$UserName,$UserOU,dc=$DomainName,dc=$Toplevel")



Hop it helps

Regards

Peter