The other day I ran into a problem with email enabled lists in SharePoint. I set up SharePoint to allow incoming email. The company wanted the email in SharePoint to have the same domain as the rest of the email address for the company. We used SharePoint Directory Management Service and created a new OU to store all the email contacts. We set up the SMTP server name to be the SharePoint SMTP server and set the display address to be the companies email. However, when the user is created, the primary email address’s domain is the name of the SMTP server. This causes a problem in that AD won’t assign the company email domain to the contact using the recipient policies because it is the primary email in the recipient policy, which wouldn’t assign two primary email addresses to the contact. To solve the problem I wrote a simple PowerShell script to look at all the users and assign the email address to all the contacts in the OU that didn’t already have an email address of the set domain. The beginning of the script will allow you to set the domain, OU and domain of the email. You can either run the script manually whenever you want, or set it to run as a scheduled task.You also don’t need to run the script on your Exchange Server, or even have PowerShell running on your Exchange server, you can run it from whatever computer you wish as long as it has PowerShell installed and has access to write to the users in the OU on the Exchange Server. I ran it from my 64 bit Vista Machine without and problems.You can download the script here.