Link to home
Start Free TrialLog in
Avatar of Barwa
Barwa

asked on

ADModify SMTP Variables

Hi,

I am trying to change the default SMTP address of all Windows server 2003/Exchange server 2003 users from the default value to firstname.lastname@domain.com using ADModify

The issue is that the "last name" field on AD contains more than a single word so how can we:

1- Eliminate the spaces in the "last name" field

or

2- Use only the last word in the "last name" field




An example follows

Our AD is populated as follows:

The first name field contains only the first name
The last name contains the (father name + family name)

Now we need the SMTP address to look like:

firstname.fathername.familyname@company.com

or

firstname.familyname@company.com

Regards

ASKER CERTIFIED SOLUTION
Avatar of Alan Hardisty
Alan Hardisty
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The spaces will be an issue and ideally you will need to either change the Last Name field to reflect the name you want, or manually change the addresses that don't get updated properly.
There is also a good reference here:
http://support.microsoft.com/kb/822447
This suggests that you might be able to use the following syntax:
%g.%r .%s@company.com
I have tested this on a live server (Exchange 2003) and can confirm that this works by producing the following:
Firstname.Fathername.Familyname@company.com
Avatar of Barwa
Barwa

ASKER

Thanks Alan, in fact I am using ADModify to do the bulk changes

So the spaces would remain an issue so that if a user is named as:

  • First name is FirstName
  • Last name is Fathername FamilyName
Then using this methode , his new SMTP address would be:

FirstName Fathername FamilyName@company.com

How would Exchange treat the spaces in that case?


Regards
In my last but one post - I have posted the solution that would provide you with firstname.fathername.familyname@company.com.
If you setup a Recipient Poliy (not ADModify) and use
%g.%r .%s@company.com (there is a space after %r)
Then this will work.
%r is the replace command and the space gets replaced with a period from the Lastname Field.  So if your lastname is Fathername Familyname it will end up as Fathername.Familyname.
Avatar of Barwa

ASKER

Sorry , I didn't notice that

I think firstname.fathername.familyname would be too long , how can we simply make this as:

firstname.familyname@company.com  even if the father's name is part of the "last name" field in AD

Regards
I am not aware of a simple solution to achieve this.  As everyone's name are going to be different and will no doubt have different length names, there is no elegant way to do this.
You can restrict the familyname part to a certain number of characters, but that is about it with Address Policies:
%g.%8s@company.com will produce firstname.1st 8 Characters of Familyname@company.com
This is a good tool & its free to modify user attribute in AD..:-)
Download & try this.
http://www.wisesoft.co.uk/software/passwordcontrol/bulk_modify.aspx 
Avatar of Barwa

ASKER

Thanks , so the problem is in the "lastname" field itself or the %s variable
In fact and following alan's advice , I have added a new SMTP address to the existing recipient policy in the form:
%g.%s@company.com
the resultant email ID for all users was firstname.lastname@company.com without spaces but again if the last name field contains more than one word then it would appear in the SMTP address
The disadvantage to this method is that it gives a long email ID that is not so good-looking on a business card :)
 
Yes, the problem is because you have too many names in the lastname field.

If you didn't have fathersname and familyname there would not be a problem, but hopefully you have a solution now.
Avatar of Barwa

ASKER

Thanks Alan
Avatar of Barwa

ASKER

Hi Alan , we have manually modified the "lastname" field of all user accounts to have a single word in it which is basically the family name

Now , I need to reverse the effect of the first.middle.last@company.com effect and remove all such SMTP addresses for all users

I have done the followings already:

  1. Removed the %s.%g entry from the recepient policy
  2. Right-clicked the recepient policy with "apply this policy now" selected
  3. Right-clicked the two default "recepient update service" entries with "update now" selected
I have also tried to run ADModify with , remove SMTP address using the following entry:

smtp:%'givenName'%.%'sn'%@company.com

None of them worked for me , do I just need to wait for this to happen automatically after sometime?

Regards
The recipient policies only add smtp addresses, they don't take them away I am afraid.  As far as I am aware, you will need to manually remove the email addresses that you no longer need and replace the recipient policy %g.%s@company.com which will put back the firstname.familyname@company.com address in the new correct format.
Avatar of Barwa

ASKER

That is too much work to do

Can't we simply do that with tools like ADModify?

Regards
I think you can use Admodify to remove addresses based on the policy we applied earlier e.g., %g.%s@company.com
Avatar of Barwa

ASKER

Thanks Alan , I think when it comes to removing SMTP addresses with ADModify , it only understands the @domain.com part so what I think of doing is to run this tool with the option *@domain.com against all users so that it cleans out all first.middle.last@domain.com addresses of all users including the defualt ones and then run the %g.%s using the recepient policy

Regards
No problems - obviously difficult to know about your environment without seeing it, but I would imagine stripping them all and then applying the recipient policy will be a good idea.