Thursday, August 02, 2007

Exchange 2007, legacyExchangeDN and mail-enabled user conversions

This was an interesting topic that just recently came up in the TechNet forums. The original poster came up with a good solution.

Essentially, during his migration, he is converting mail-enabled users to mailbox-enabled users, but their legacyExchangeDN attribute is changing. This causes problems when users reply to messages that person originally sent or if they have his/her name in their Outlook nickname (NK2) file. Essentially, the legacyExchangeDN no longer exists in the directory so existing messages and NK2 entries don't work anymore.

The solution is to document the account's legacyExchangeDN before removing the mail attributes from the mail-enabled user and then adding that legacyExchangeDN address to the new mailbox-enabled user as an X500 address. The person that was looking for a solution (Jim Mulvey) wrote a nice PowerShell / EMS script to handle this.

$SourceRecipient = Get-Recipient $emailaddress
If ($SourceRecipient.RecipientType -eq "MailUser" {
$OldLegacyExchangeDN = [string]$SourceRecipient.LegacyExchangeDN
$DistinguishedName = [string]$SourceRecipient.Identity.ToCanonicalName()
$EmailAddresses = $SourceRecipient.EmailAddresses
Disable-MailUser $DistinguishedName -confirm:$false


#An inexplicable 5 minute delay here would ensure the Mailbox object gets the
#same LegacyExchangeDN as the old MailUser object. But we really shouldn't have
#the user's email bounce for 5 minutes before we welcome them to Exchange.

$TargetRecipient = Enable-Mailbox -identity $DistinguishedName -database 'Server01/SG01/DB01'
Set-Mailbox $TargetRecipient -EmailAddresses $EmailAddresses

#Check to see if the New LegacyExchangeDN is the same as the old one
#If not, add the old LegacyExchangeDN as an additional Proxy Address

If ([string]$TargetRecipient.LegacyExchangeDN -ne $OldLegacyExchangeDN) {
$EmailAddresses += [Microsoft.Exchange.Data.CustomProxyAddress]("X500:" + $OldLegacyExchangeDN)
Set-Mailbox $TargetRecipient -EmailAddresses $EmailAddresses
}

"Conversion of user from MailUser to Mailbox complete."
} Else { throw "This script only converts MailUser objects to Mailbox objects" }

Labels:

11 Comments:

At 12:49 AM, Blogger Mauro said...

Great article for a need we had in our current project. I'd better start reading those Technet forums :-)

Thank you,Jim!

 
At 9:22 PM, Blogger ghkj said...

welcome to the wow power leveling cheap wow power leveling service site,WoW Gold buy cheap wow gold,wotlk gold,world of warcraft power leveling buy wow gold

 
At 9:07 PM, Blogger jjddgo said...

aion chinaaion china goldaion cn goldaion chinese goldaion gold chinaaion gold chinesechina aion goldchinese aion goldaion china kinaaion chinese kinaaion kina chinachina aion kinaaion china buybuy aion chinaaion chinese server goldaion cn server goldaion china server goldchina aion server goldchinese aion server goldaion chinese server goldaion cn server kinaaion china server kinachina aion server kinachinese aion server kina

 
At 7:02 PM, Blogger vfdvgf said...

We always Wow Power Leveling and world of warcraft gold

 
At 12:32 PM, Blogger dreaz said...

I am grateful to you for this great content.aöf thanks radyo dinle cool hikaye very nice ssk only cinsellik very nice ehliyet only home free kadın last go korku jomax med olsaoy hikaye lesto go müzik dinle free only film izle love aşk only mp3 indir only radyolar lest go açıköğretim free net only filmler

 
At 1:15 PM, Blogger wo said...

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I like it

 
At 1:16 PM, Blogger wo said...

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . good,very good!

 
At 1:16 PM, Blogger wo said...

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . .

This article is very good,I like it !

 
At 1:17 PM, Blogger wo said...

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . good!good!

 
At 1:17 PM, Blogger wo said...

. . . . .
. . . .
. . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
I like it,good,very good!

 
At 7:40 PM, Blogger nanchang said...

Your blog is very good, it's the best blog I've ever seen, thank you!
By the way, do you like polo shirts, which are very chic, especially the polo t shirts, I love them very much. I also like playing tennis rackets, it can keep healthy, what do you like to do? I'd like to introduce myself as the outlet of polo t shirts women, polo t shirts on sale, and polo t shirts for women. These products are our masterpieces, such as polo shirts on sale, polo shirts men, men's polo shirt, men polo shirt, mens polo shirts, mens polo shirt, besides we also sell cheap polo shirts, discount polo shirts, men's polo shirts, women's polo shirts. We are also the outlet of, cheap tennis racket, discount tennis racket, we recommend prince tennis racquet, head tennis rackets, wilson tennis racket, babolat tennis racquet. And it is our great pleasure that you come to our store online!

 

Post a Comment

<< Home