Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

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

Avatar of CecilAdmin
CecilAdminFlag for United States of America asked on
Active Directory
3 Comments1 Solution509 ViewsLast Modified:
https://www.experts-exchange.com/Programming/Misc/Q_21977773.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?