and more in a single search tool across platforms. Read the announcement here. |
05/01/2024 10:28 AM
Hello All,
I am trying to set a password while creating an AD account.
syntax:
"unicodePwd": "${'PasswordCo' + ((new Date().getMonth() + 1).toString().padStart(2, '0')) + (new Date().getFullYear().toString().slice(-2)) + (Math.floor(1000 + Math.random() * 9000))}",
I am seeing below errors in the logs if i use this above syntax.
05/01/2024 10:51 AM
05/01/2024 10:54 AM
@Saathvik
Yes if i remove the password and set a random password/hardcoded password it is working.
{
"cn":"${cn}",
"givenname": "${user.firstname}",
"displayname": "${user.firstname} ${user.lastname}",
"userAccountControl": "512",
"sAMAccountName": "${task.accountName}",
"sn": "${user.lastname}",
"pwdLastSet": "0",
"userPrincipalName": "${task.accountName}@pcorp.net",
"unicodePwd": "PasswordCo05244692",
"extensionattribute9": "${user.customproperty9}",
"AMFeffectivedate": "${user.customproperty8}",
"title": "${user.customproperty24}",
"department": "${user.departmentname}",
"employeeNumber": "${user.username}",
"employeeID": "${user.username}",
"name": "${user.username}",
"objectClass": [
"top",
"person",
"organizationalPerson",
"user"
]
}
05/01/2024 11:25 AM - edited 05/01/2024 11:50 AM
@GPS : Please remove CN mapping and see if that works. If still not working then I believe issue with new Date(), Instead of it use calendar instance
Replace new Date().getMonth() with Calendar.getInstance().get(Calendar.MONTH
new Date().getFullYear() with Calendar.getInstance().get(Calendar.YEAR)
05/01/2024 11:22 AM
05/01/2024 02:40 PM
new String("\"PasswordCo${(new Date().getMonth() + 1).toString().padLeft(2, '0')}${(new Date().format('yy'))}${(1000..9999).collect{it}.shuffle().first()}\"".getBytes("UTF-16LE").encodeBase64())