Home All Groups Group Topic Archive Search About

Populate email attribute in AD



Author
12 Aug 2005 1:44 AM
Ringo
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?

Author
12 Aug 2005 2:01 AM
Marty List
"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?
Author
12 Aug 2005 8:01 AM
Ringo
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?
>
>
>
>
Author
12 Aug 2005 1:05 PM
Marty List
Show quote
"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?
Author
14 Aug 2005 11:04 PM
Ringo
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?
>
>
>
>
Author
19 Oct 2005 3:53 PM
Seth
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?
>
>
>
>

AddThis Social Bookmark Button