Hi Folks, I tried useing this snippet of code but for some reasons its not working. I was wondering if some kind soul to take a look at it, if not does anyone have a script to create an NT account useing LDAP that they could post. Any help would be much appreciated.

Thanks

Glyn

Below is the code i'm trying to use and the error message when runng the program.

 Originally Posted By: apronk
Please try this code, you've made a few errors, one of which is having "LoginScript" 2 times, LoginScript is actually "scriptPath", You need to use .SetInfo 2 times, one before you enable the account and set password. And some "" errors. here is the cleaned up code:
 Code:
CreateAccount("123456","Lastname Test", "LDAP://OU=test,OU=ouinformation,OU=nextleaveOU, dc=Domain ,dc=ad")

Function CreateAccount($UserName, $FullName, $ADsPath)
  $OU = GetObject($ADsPath)
  $UserObj = $OU.Create("User","cn="+$FullName)
  $UserObj.Put("sAMAccountName", $UserName)
  $UserObj.Put("givenName", "John") ;First Name
  $UserObj.Put("Initials", "Frank") ;Initials
  $UserObj.Put("sn", "Smith") ;Last Name(Surname)
  $UserObj.Put("displayName","Smith" + IIf("smith", ", ","") + "John" + IIf("Frank", " ", "") + "Frank") ;Display name
  $UserObj.Put("description", "Head Man in charge") ;Description
  $UserObj.Put("physicalDeliveryOfficeName","Wahington, DC") ;Office
  $UserObj.Put("telephoneNumber","222-555-5555");Telephone
  $UserObj.Put("mail","first_Last@company.com") ;E-mail
  $UserObj.Put("wWWHomePage","www.kixtart.org") ;Web page
  $UserObj.Put("userPrincipalName", "123456") ;userPrincipalName
  $UserObj.Put("scriptPath", "common.bat") ;Logon Script
  $UserObj.Put("Street", "1234 A Street, NW") ;Street
  $UserObj.Put("Password", "gensler")
  $UserObj.SetInfo

  ; Added Code
  $userObj.SetPassword("password")    ;Sets the password to "newpassword"
  $userObj.Put("pwdLastSet", 0)       ;User has to change the pw as soon as he/she logs in
  $userObj.AccountDisabled = 0        ;Enables the account
  $UserObj.SetInfo

  ; Objects cleanup
  $UserObj = 0
  $OU = 0
EndFunction



Hi ya.

Can you help when I run this code on Kix 4.60 I get an error message see below.

ERROR : expected ')'!
Script: H:\Folder Lock\Locker\Misc Stuff\Kix\AdminScriptEditor\ldap6.kix
Line : 36

This is what the line is
$UserObj = $OU.Create("User", "cn=" + $FullName)

can any one help me with this one, I would love to get this working.

Thanks

Glyn