Avatar of CecilAdmin
CecilAdmin
Flag for United States of America asked on

Leading Zero in Password Field of Active Directory via import not working correctly...

https://www.experts-exchange.com/questions/21977773/Import-Active-Directory-Users-From-a-CSV-File-Logon-FirstName-LastName-Password.html
^I have used this script to create accounts without an issue.

An import of a .csv with username, fname, lname, password, and id complete successfully; however, any password in the password field that has a leading zero does not work.  For example, I have a list of over a hundred users with their date of birth mmddyyyy set as their password.  Any user that has a birthday in a month that has a leading zero (e.g., 01, 02, 03, etc... do not work with the set password); however, accounts without a leading zero (e.g., 10, 11, 12) work with the same password scheme without an issue (even those without leading zeros and zeros in other fields like year).  You can see the password with the leading zero in plain text .csv import file, so I do not think it is a file issue.  There are no trims, lefts, rights, or anything like that going on with the password field inside of the script.  This is a consistent pattern throughout hundreds of accounts.

For example .csv imported accounts that successfully import and allow successful login:
samAccountName,FName,LName,Password,empID

jdoe,John,Doe,10131991,111
jfloe,Jane,Floe,11131990,222
fdoe,Fred,Doe,1201980,333

For example .csv imported accounts that successfully import, yet fail to login:
samAccountName,FName,LName,Password,empID

tdoe,Tom,Doe,01221991,444
efoe,Elaine,Deer,03191990,555

^All other information imports successfully and enabled, yet for some reason the passwords with leading zeros simply do not work...  I have tried several combinations with and without zeros to try to isolate the issue, and it seems like VBScript just cuts out that leading zero.

I do a wScript.echo sPassword and I can see that in the .vbs output the leading zero is missing, but I do not know exactly where this happens... perhaps:

sPassword = oRecordSet.Fields.Item(3).value

Is there any way I can preserve this leading zero?
Active Directory

Avatar of undefined
Last Comment
oBdA

8/22/2022 - Mon
CecilAdmin

ASKER
sPassword = Right("0000000000" & sPassword = oRecordSet.Fields.Item(3).value, 8)
CecilAdmin

ASKER
****

sPassword = Right("00000000" & sPassword = oRecordSet.Fields.Item(3).value, 8)
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61