locked
Email address policy - Multiple names in "First name" field RRS feed

  • Question

  • Hi,

    I will try to explain my challenge:-)

    We have an Exchange 2007 organization and we want to create a custom Email Address Policy.  We are using %s.%g@domain.local today. If there are users with a double first name in the "First name" field in ADUC, for instance "Billy Bob", we want the result to be Billy-Bob.surname@domain.local

    I am not sure how to fit in the "dash" between the two firstnames in the "First name" field (without manually enter "billy-bob" in "first name field") 

    Has anyone a suggestion to get this solved?

    Monday, November 28, 2011 10:24 AM

Answers

  • Hi Are

    Perhaps it is not an exchange question, because the format for email address policy is by default.

    But as your requirement, I wrote a foreach loop in EMS to Change the FirstName for all the users who has a double first name. After runing, the FirstName such as "Billy Bob" will be rewrite as "Billy-Bob".  It was tested on my exchange server.

    -------------------------------------------------------------------------------

    $Users = Get-User | where {$_.firstname -like "* *"}
    $j = 0
    ForEach ($User in $Users)
    {
    $i = 0;
    $FName = ($Users[$j].firstname).toString();
    while ($i -lt $FName.length)
    {
    if ($FName[$i] -eq " ")
    {$NewFName = $NewFName + "-";
    }
    else
    {
    $NewFName = $NewFName + $FName[$i];
    }
    $i++
    }
    Set-User $User -firstname $NewFName;
    $NewFName = ""
    $j++
    }

    ------------------------------------------------------------------

    Hope it helps

    Cheers

    Zi Feng

    Wednesday, November 30, 2011 9:36 AM
    Moderator

All replies

  • Hi Are,

    Seems like you cannot do it by custom email address policy, maybe you have to edit the email address for these users manually .

    Or you can try to filter the users, modify the addresses in txt/csv file, after that, import the csv file and run a foreach syntax to bulk add/edit the addresses.

    By the way, you can also seek the solution in the Development forum.

    http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/threads

    Frank

     

    Wednesday, November 30, 2011 8:10 AM
  • Hi Are

    Perhaps it is not an exchange question, because the format for email address policy is by default.

    But as your requirement, I wrote a foreach loop in EMS to Change the FirstName for all the users who has a double first name. After runing, the FirstName such as "Billy Bob" will be rewrite as "Billy-Bob".  It was tested on my exchange server.

    -------------------------------------------------------------------------------

    $Users = Get-User | where {$_.firstname -like "* *"}
    $j = 0
    ForEach ($User in $Users)
    {
    $i = 0;
    $FName = ($Users[$j].firstname).toString();
    while ($i -lt $FName.length)
    {
    if ($FName[$i] -eq " ")
    {$NewFName = $NewFName + "-";
    }
    else
    {
    $NewFName = $NewFName + $FName[$i];
    }
    $i++
    }
    Set-User $User -firstname $NewFName;
    $NewFName = ""
    $j++
    }

    ------------------------------------------------------------------

    Hope it helps

    Cheers

    Zi Feng

    Wednesday, November 30, 2011 9:36 AM
    Moderator