One Star

create AD account with unicodePwd

This is my context : data transfer from an annuary to an AD.
At first, data are stored in ldif files and I take information I need to create an AD account. I saw in many forums that we must create first the account without a password, and then modify it, adding the password.
The creation of the AD account with the attribute userAccountControl set to 546 or 514 works well (Normal Account = 512, Account Disabled = 2 et Password not Required = 32). On the other hand, when I want to modify the created account in order to set the userAccountControl attribute to 512 with a password (unicodePwd attribute), there is a problem.
I would want to assign the default value "example" to the account password (which the user will have to modify at his first loggin). This password must be encoded in Unicode UTF-16, and before the unicode conversion is done the password needs to be surrounded by double quotes which do not belong to the user's password. So I write it this way : unicodePwd = "\"example\"".getBytes("UTF-16LE").
And I have the following error : Cannot invoke trim() on the array type byte[], because of the fact that trim() applies to Strings I guess.
I tried to convert the unicodePwd into String, I also have an error, but not the same : [LDAP: error code 53 - 0000001F: SvcErr: DSID-031A0FC0, problem 5003 (WILL_NOT_PERFORM), data 0.
So how can I prevent trim() to do that? Or Did I understand well the mechanism of unicodePwd and userAccountControl ?
Thank you for your help
One Star

Re: create AD account with unicodePwd

Hi I have a similar problem setting a password in AD what i do know is the you need a ssl connection to the AD to be able to set an password, One other thing if you set your userAccountControl to 544 you wil be able to create a user which will be prompt change there password after first login with a blank password. The big issue is setting a password thats why you get a (WILL_NOT_PERFORM), the user you use must also have the full permission in AD to set a password.
Hope this helps
Let me know if you are able to set a password as that will help meSmiley Happy