MS Exchange 2007 / 2010 Convert Mailbox to MailUser Powershell

NOTE: These commands (speficially #4) requires Powershell v2.0

1. Load the existing mailbox in to a variable

[PS] c:\scripts> $mailbox = get-mailbox -identity [username]

2. Disable the mailbox

[PS] c:\scripts> disable-mailbox $mailbox.samaccountname -confirm: $false

3. Create the MailUser

[PS] c:\scripts> Enable-MailUser -Identity $mailbox.userprincipalname -Alias $mailbox.samaccountname -PrimarySMTPAddress $mailbox.PrimarySmtpAddress

4. Update the MailUser with secondary addresses

[PS] c:\scripts> foreach ($i in ($mailbox.EmailAddresses)){if ($i.prefixstring -eq "smtp"){set-mailuser -identity $mailbox.userprincipalname -emailaddresses @{Add=$i.addressstring}}}

5. Update the MailUser with X500 addresses (if required)

[PS] c:\scripts> foreach ($i in ($mailbox.EmailAddresses)){if ($i.prefixstring -eq "X500"){set-mailuser -identity $mailbox.userprincipalname -emailaddresses @{Add="X500:"+$i.addressstring}}}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s