Script: Fix-ProxyAddress.ps1

I recently blogged about the “MigrationPermanentException: The target mailbox doesn’t have an SMTP proxy matching ‘company.mail.onmicrosoft.com’.” error message that occurs when attempting to perform a remote mailbox move for a user that doesn’t have the correct SMTP proxy address. I put together a script to help simplify the process of adding the relevant SMTP proxy address to effected users.

Once launched, the script will prompt for your tenant routing domain in the format ‘company.mail.onmicrosoft.com’ and will search for all mailboxes in the organization that do not have an email address policy applied. A new SMTP proxy address will be added to all mailboxes without an email address policy. The proxy address will be based on the alias of the primary SMTP address and the routing domain entered, e.g if the primary SMTP address is john.smith@company.com and the routing domain entered is company.mail.onmicrosoft.com the resulting proxy address will be john.smith@company.mail.onmicrosoft.com.

Requirements: This script has been tested and is known to work with Exchange 2010 and Exchange 2013.

Usage: There are no parameters or switches, simply execute the script:

.\Fix-ProxyAddress.ps1

Execution Policy: The script has been digitally signed and will run just fine under a “RemoteSigned” execution policy.

Screenshots:

script1

script2

script3

Download: I have published it to the TechNet Gallery, it can be downloaded by clicking here…

Post navigation


Comments

  • Patricia McLelland

    This is awesome! Thank you. I am getting an error though (it’s red), can you help me?

    Set-Mailbox : Cannot bind parameter ‘EmailAddresses’. Cannot convert the “Syste
    m.Collections.Hashtable” value of type “System.Collections.Hashtable” to type ”
    Microsoft.Exchange.Data.ProxyAddress”.
    At C:\users\bigpmclelland\desktop\Fix-ProxyAddress.ps1:541 char:49
    + Set-Mailbox $Mailbox -EmailAddresses <<<< @{add="$Alias@$Routing
    Domain"}
    + CategoryInfo : InvalidArgument: (:) [Set-Mailbox], ParentContai
    nsErrorRecordException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Exchang
    e.Management.RecipientTasks.SetMailbox

  • Chris

    Hi Patricia,

    Could you tell me a little about your environment? OS/Exch version, etc? Feel free to email me directly if you’d rather not share than info publicly.

    Thanks,

    Chris

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>