Re: CSVDE Password Limitations - [WP]

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





Thank you Richard for your assistance.

I was able to find a VB with which I can enable all the accounts which are
imported from the CSV and now from here on I will check into the script which
you mentioned to assign a password.

Yes, I intend to assign a generic password for all these users.



"Richard Mueller [MVP]" wrote:


"WILDPACKET" <WILDPACKET@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F5C41503-810B-4050-ADE7-3762DE936B5C@xxxxxxxxxxxxxxxx

I am importing users into AD from CSV file and ran into password assigning
limitations. For now I would like to assign a generic password for all
the
users.

I am importing these users in a OU and they will be disabled when
imported.
How can I assign password to these users so they could change them at
logon?

CSVDE does not let me do this? How can I assign password to these users?
I
am trying to avoid VB or other complex scripts.

The csvde utility cannot assign passwords. Since you already have the csv
file with user Distinguished Names, this can be used with either a command
line utility or a script to assign the passwords, assuming you intend to
assign the same password to all of the new users. A VBScript example could
be:
==============
Const ForReading = 1

' Specify the csv file.
strFilePath = "c:\MyFolder\NewUsers.csv"

' Open the file for read access.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFilePath, ForReading)

' Specify the new password.
strPassword = "zyx$321"

' Read each line of the file.
Do Until objFile.AtEndOfStream
strLine = Trim(objFile.ReadLine)
' Skip blank lines.
If (strUserDN <> "") Then
' Parse the line into fields
' delimited by a quote followed by a comma.
arrFields = Split(strLine, """,")
' User DN is the first field with the leading
' quote stripped off.
strUserDN = Mid(arrFields(0), 2)
' Bind to the user object.
Set objUser = GetObject("LDAP://"; & strUserDN)
' Set the password.
objUser.SetPassword strPassword
End If
Loop

' Clean up.
objFile.Close
==========
The hard part is parsing the csv file. We know that the user DN is the first
field and that it must be enclosed with quotes, because we know it has
embedded commas. We do not know if any of the other fields are enclosed with
quotes, but that's OK. If we use the Split function to break up the line
into fields delimited by a quote followed by a comma, we know the first
field (index 0 since arrays are zero based) will be the user DN with a
leading quote, but with the trailing quote stripped off. The Mid function
strips off the leading quote by taking all of the first field starting with
the second character.

I also have a few example VBScript programs to reset passwords linked on
this page:

http://www.rlmueller.net/freecode4.htm

The first three programs are for setting passwords in bulk, the first two
from text files, the third from a spread***. These would be useful if you
want to assign a different password for each user (and communicate the
password to each user individually). Your csv file can be easily converted
to a spread***, where you could insert a column (the second column) for
the password.

If you want to stay away from scripts, I believe Joe Richards' free ADMod
command line utility can do this. You'll have to check his documentation:

http://www.joeware.net/freetools/tools/admod/index.htm

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--



.


Quantcast