Post by hermesjrdHi every one
User Logon name
And
User logon name (pre-windows 2000)
For 2400 + user -
I have on excel (actual user logon names + what would be the new user logon
name).
Reason: this company wants to use jobs tiltles as logon name and email
accounts.
Before hand
.
The "pre-Windows 2000 logon name" is the value of the sAMAccountName
attribute, also called the NT name of the user. This value must be unique in
the domain but can be modified directly. I'm not sure what you mean by the
first "User Logon name" you mention. If this is the Common Name (the field
labeled "Name" in ADUC), then it is the value of the cn attribute. However,
this value does not uniquely identify the user. The value must be unique in
the OU (or container), but there can be several users in the domain with the
same Common Name. Also, given just the Common Name we don't know where in AD
the object resides so we must search AD for the user. Then we must handle
the 3 possible cases - there are no user objects with the specified Common
Name, there is one user, or there is more than one (in which case you don't
know what to do). To modify the Common Name you must rename the object.
Best would be to have a spreadsheet with the Distinguished Names of all
users. I have an example VBScript program that creates such a spreadsheet
for all users in the domain linked here:
http://www.rlmueller.net/Create%20User%20List%203.htm
The Common Name of the user (the value of the cn attribute) is part of the
Distinguished Name (DN). For example, if the DN is "cn=Jim
Smith,ou=Sales,ou=West,dc=MyDomain,dc=com", then the Common Name is "Jim
Smith". Once you have a spreadsheet with Distinguished Names, you can add
columns for the new Common Name and the new pre-Windows 2000 logon name. A
VBScript program can read the spreadsheet and for each row:
1. Use the DN in the first column to bind to the user object.
2. Use the Parent method of the user object to bind to the Parent
OU/Container.
3. Retrieve the new Common Name from the second column.
4. Use the MoveHere method of the parent object to rename the user (new
Common Name).
5. Retrieve new pre-Windows 2000 logon name from the third column.
6. Assign this value to the sAMAccountName attribute.
7. Invoke the SetInfo method to save changes.
Does this make sense? Once you verify, I can post sample code that does
this.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--