CecilAdmin
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,2 22
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?
^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
jdoe,John,Doe,10131991,111
jfloe,Jane,Floe,11131990,2
fdoe,Fred,Doe,1201980,333
For example .csv imported accounts that successfully import, yet fail to login:
samAccountName,FName,LName
tdoe,Tom,Doe,01221991,444
efoe,Elaine,Deer,03191990,
^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).
Is there any way I can preserve this leading zero?
ASKER
****
sPassword = Right("00000000" & sPassword = oRecordSet.Fields.Item(3). value, 8)
sPassword = Right("00000000" & sPassword = oRecordSet.Fields.Item(3).
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER