Monday, December 22, 2008

Converting Mail-Enabled recipient to Mailbox-Enabled recipient

    Out of the box, MS Exchange 2003/2007 do not offer any kind of way converting a mail-enabled recipient (MEU) into a mailbox-enabled recpieint (MBXU).  At first, you would think that scenario is least likely. Mail-enabled recipients forward to outside of exchange organization and why would you create a mailbox.  Well, in complex environments where organization has multiple email systems and a user wants to migrate to exchange but already utilizes AD, or if your organization is going through a complex migration.

    To convert an MEU into MBXU, we could just strip the AD object of exchange attributes and then ask exchange to create a mailbox.  However, you will notice that there might be side effects. Any secondary emails that might be attached to the MEU are now gone.  Secondly, a less trivial issue, is that repliability of emails which contain MEU address book entry is now broken. To fix these both, you’ll need to track secondary emails and legacyExchangeDn of the MEU and append them to proxyAddresses attribute when MBXU is created.

$userIdentity = 'testuser'
$mailboxDatabase = exserver\mbxdb'
$err = @()
$user = Get-MailUser -Identity $userIdentity `
-ErrorAction SilentlyContinue -ErrorVariable +err
if ($err.count -ne 0)
Write-Error '
The user is not a mail-enabled user.'
$mbxDB = Get-MailboxDatabase -Identity $mailboxDatabase `
-ErrorAction SilentlyContinue -ErrorVariable +err
if ($err.count -ne 0)
Write-Error "The database value is incorrect."
$extAddress = $user.ExternalEmailAddress
$currAddresses = $user.EmailAddresses
$legDn = $user.LegacyExchangeDn
Disable-MailUser $user -Confirm:$false | Out-Null
$mbxUser = Enable-Mailbox $user -Confirm:$false `
-Database $mailboxDatabase
$addresses = $mbxUser.EmailAddresses
if ($mbxUser.LegacyExchangeDn -ne $legDn) {
$currAddresses | ?{ $_ -ne $extAddress } | %{
if ( -not $addresses.Contains($_)) {
$addresses.Add($_) | Out-Null
if ($addresses.Changed) {
Set-mailbox $mbxUser `
-EmailAddresses $addresses | Out-Null


backup online said...

Thanks for the info! Very useful!

Frost Hon said...

Hi, thank you very much for the scripts, it help me a lot.

How can I use it to apply to a list of users instead of one user?

I have a project which will involve more than 1000 users.

Please help if you can, I would appreciate it very much.

Roman Rozinov said...

you can definitely apply this schematic to the list of users instead of one.
Wrap the code into a a function
MoveUser($userIdentity, $mailboxDatabase) {
[original code here minues the first 2 lines]

then you can probably create a file users.txt with identity, mbxdb on each line.
gc file.txt | @{ MoveUser($_.split(',')[0], $_.split(',')[1])) }

Brian Reid said...

In Exchange 2010 you can just use the following:

Get-MailUser name | Enable-Mailbox