|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Populate email attribute in AD
I would like to have a script that I can use to populate email field found on
the General tab if AD user account properties. There are about 500 users in an OU whose email field needs to be populated. The email should be in a format fistname.lastn***@company.com format. I have exported the user list from AD to a csv format. I am very new to scripting. Can anyone point me to right direction? "Ringo" <Ri***@discussions.microsoft.com> wrote in message Do you need to use the CSV list? It might be easier to just search AD and news:FE468EC7-7286-4456-8FE2-1C56A792FB00@microsoft.com... >I would like to have a script that I can use to populate email field found >on > the General tab if AD user account properties. There are about 500 users > in > an OU whose email field needs to be populated. The email should be in a > format fistname.lastn***@company.com format. I have exported the user list > from AD to a csv format. I am very new to scripting. Can anyone point me > to > right direction? find every account without an email address, or every account without the correct email address. If you need to use the CSV, post the format, or an example of one record and whethe it has a header row, etc. What do you want the script to do if it comes across an account with a blank firstname or lastname? What do you want the script to do with uppercase/lowercase names? For example if the firstname/lastname in AD is "JOHN DOE" do you want the email address to be "JOHN.***@company.com" or "john.***@company.com" What do you want the script do do if the firstname or lastname has a invalid SMTP character like a space in it? Thank you Marty very much for your reply.
I do not have to use the CSV file. My understanding is a script will read the CSV file for user display names, then find that user account in AD and then populate the email field. Currently all users' email field is blank. If the script encounters a blank username field it will skip that account, similarly if an user account has only one name i.e JOHN and no last name, the email address will be j***@company.com instead of firstname.lastn***@company.com format. If an account display name has any unsupported characters such as a space, it will skip that account but would be nice to generate a text file with all failed/skipped accounts for whatever reason. If it encounters an account with uppercase, it would be nice to convert them to lower case. Here is an example of the CSV file: Name Type Description John Doe User Marketing User The CSV is just an exported list from Windows 2003 AD user OU. It has a header row, three columns - Name, Type and Description. The name is the user display name and not the user login name. For example, user display name is John Doe but his login name is JDoe. The email address for this user should be john.***@company.com Much appreciated if you could halp me with this script. Many thanks Ringo Show quote "Marty List" wrote: > > "Ringo" <Ri***@discussions.microsoft.com> wrote in message > news:FE468EC7-7286-4456-8FE2-1C56A792FB00@microsoft.com... > >I would like to have a script that I can use to populate email field found > >on > > the General tab if AD user account properties. There are about 500 users > > in > > an OU whose email field needs to be populated. The email should be in a > > format fistname.lastn***@company.com format. I have exported the user list > > from AD to a csv format. I am very new to scripting. Can anyone point me > > to > > right direction? > > > Do you need to use the CSV list? It might be easier to just search AD and > find every account without an email address, or every account without the > correct email address. > > If you need to use the CSV, post the format, or an example of one record and > whethe it has a header row, etc. > > What do you want the script to do if it comes across an account with a blank > firstname or lastname? > > What do you want the script to do with uppercase/lowercase names? For > example if the firstname/lastname in AD is "JOHN DOE" do you want the email > address to be "JOHN.***@company.com" or "john.***@company.com" > > What do you want the script do do if the firstname or lastname has a invalid > SMTP character like a space in it? > > > >
Show quote
"Ringo" <Ri***@discussions.microsoft.com> wrote in message My suggestion then is to skip the CSV file, just enumerate the accounts in news:D6F63751-85AE-40E1-B231-620539AD9DF9@microsoft.com... > Thank you Marty very much for your reply. > I do not have to use the CSV file. My understanding is a script will read > the CSV file for user display names, then find that user account in AD and > then populate the email field. Currently all users' email field is blank. > If the script encounters a blank username field it will skip that account, > similarly if an user account has only one name i.e JOHN and no last name, > the > email address will be j***@company.com instead of > firstname.lastn***@company.com format. If an account display name has any > unsupported characters such as a space, it will skip that account but > would > be nice to generate a text file with all failed/skipped accounts for > whatever > reason. If it encounters an account with uppercase, it would be nice to > convert them to lower case. > > Here is an example of the CSV file: > Name Type Description > John Doe User Marketing User > > The CSV is just an exported list from Windows 2003 AD user OU. It has a > header row, three columns - Name, Type and Description. The name is the > user > display name and not the user login name. For example, user display name > is > John Doe but his login name is JDoe. The email address for this user > should > be john.***@company.com > > Much appreciated if you could halp me with this script. > > Many thanks > Ringo the OU in real time. This way you could run the script on a daily or weekly basis and clean up any accounts that were created with an incorrect email address. Let me know which design you prefer. I have a similar script written in VBScript that I can tweak to do what you want. Do you want the OU distinguished name (LDAP:// path) stored inside the script, or passed on the command line? You are right. With a vbscript in can run it in a command line real-time as
required. I have other OUs where I would like to use this script as well so it would be preferable to pass the OU LDAP path as a command line argument. Show quote "Marty List" wrote: > > "Ringo" <Ri***@discussions.microsoft.com> wrote in message > news:D6F63751-85AE-40E1-B231-620539AD9DF9@microsoft.com... > > Thank you Marty very much for your reply. > > I do not have to use the CSV file. My understanding is a script will read > > the CSV file for user display names, then find that user account in AD and > > then populate the email field. Currently all users' email field is blank. > > If the script encounters a blank username field it will skip that account, > > similarly if an user account has only one name i.e JOHN and no last name, > > the > > email address will be j***@company.com instead of > > firstname.lastn***@company.com format. If an account display name has any > > unsupported characters such as a space, it will skip that account but > > would > > be nice to generate a text file with all failed/skipped accounts for > > whatever > > reason. If it encounters an account with uppercase, it would be nice to > > convert them to lower case. > > > > Here is an example of the CSV file: > > Name Type Description > > John Doe User Marketing User > > > > The CSV is just an exported list from Windows 2003 AD user OU. It has a > > header row, three columns - Name, Type and Description. The name is the > > user > > display name and not the user login name. For example, user display name > > is > > John Doe but his login name is JDoe. The email address for this user > > should > > be john.***@company.com > > > > Much appreciated if you could halp me with this script. > > > > Many thanks > > Ringo > > > My suggestion then is to skip the CSV file, just enumerate the accounts in > the OU in real time. This way you could run the script on a daily or weekly > basis and clean up any accounts that were created with an incorrect email > address. Let me know which design you prefer. > > I have a similar script written in VBScript that I can tweak to do what you > want. Do you want the OU distinguished name (LDAP:// path) stored inside > the script, or passed on the command line? > > > > I am in need to this script. I have an Excel file with UserID and Email
address that I need to populate into Email field in AD. Could you please post the script or show me where I can get it? Show quote "Marty List" wrote: > > "Ringo" <Ri***@discussions.microsoft.com> wrote in message > news:D6F63751-85AE-40E1-B231-620539AD9DF9@microsoft.com... > > Thank you Marty very much for your reply. > > I do not have to use the CSV file. My understanding is a script will read > > the CSV file for user display names, then find that user account in AD and > > then populate the email field. Currently all users' email field is blank. > > If the script encounters a blank username field it will skip that account, > > similarly if an user account has only one name i.e JOHN and no last name, > > the > > email address will be j***@company.com instead of > > firstname.lastn***@company.com format. If an account display name has any > > unsupported characters such as a space, it will skip that account but > > would > > be nice to generate a text file with all failed/skipped accounts for > > whatever > > reason. If it encounters an account with uppercase, it would be nice to > > convert them to lower case. > > > > Here is an example of the CSV file: > > Name Type Description > > John Doe User Marketing User > > > > The CSV is just an exported list from Windows 2003 AD user OU. It has a > > header row, three columns - Name, Type and Description. The name is the > > user > > display name and not the user login name. For example, user display name > > is > > John Doe but his login name is JDoe. The email address for this user > > should > > be john.***@company.com > > > > Much appreciated if you could halp me with this script. > > > > Many thanks > > Ringo > > > My suggestion then is to skip the CSV file, just enumerate the accounts in > the OU in real time. This way you could run the script on a daily or weekly > basis and clean up any accounts that were created with an incorrect email > address. Let me know which design you prefer. > > I have a similar script written in VBScript that I can tweak to do what you > want. Do you want the OU distinguished name (LDAP:// path) stored inside > the script, or passed on the command line? > > > > |
|||||||||||||||||||||||