[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2760
  • Last Modified:

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

0
Barwa
Asked:
Barwa
  • 11
  • 7
  • 3
1 Solution
 
Alan HardistyCommented:
You should be able to change this using the recipient policy and setting the recipient policy to:
%g.%s@company.com
How to use recipient policies: http://support.microsoft.com/kb/319188
Recipient Policy Variables: http://www.computerperformance.co.uk/exchange2003/exchange2003_recipient_policy.htm 
0
 
Alan HardistyCommented:
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.
0
 
Alan HardistyCommented:
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
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
Alan HardistyCommented:
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
0
 
BarwaAuthor Commented:
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
0
 
Alan HardistyCommented:
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.
0
 
BarwaAuthor Commented:
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
0
 
Alan HardistyCommented:
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
0
 
AwinishCommented:
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 
0
 
AwinishCommented:
0
 
BarwaAuthor Commented:
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 :)
 
0
 
Alan HardistyCommented:
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.
0
 
BarwaAuthor Commented:
Thanks Alan
0
 
BarwaAuthor Commented:
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
0
 
Alan HardistyCommented:
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.
0
 
BarwaAuthor Commented:
That is too much work to do

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

Regards
0
 
Alan HardistyCommented:
I think you can use Admodify to remove addresses based on the policy we applied earlier e.g., %g.%s@company.com
0
 
BarwaAuthor Commented:
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
0
 
Alan HardistyCommented:
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.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 11
  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now