Home » Exchange Server » Exchange 2013 Test-Mailflow Error for Remote Mailbox Servers

Exchange 2013 Test-Mailflow Error for Remote Mailbox Servers

Following on from my last post about errors when running Test-ServiceHealth for Exchange 2013 Client Access servers, here is another PowerShell test cmdlet that behaves unexpectedly in Exchange 2013.

Test-Mailflow, as the name suggests, is used to test mail flow for Mailbox servers. The TechNet page provides the following example syntax:

What isn’t documented is the error that occurs if you try to run that command when your PowerShell session is connected to a server other than “Mailbox1”.

This error did not occur in Exchange 2010 under the same conditions.

As with the Test-ServiceHealth issues from my last post this situation is frustrating for me because I use Test-Mailflow in my Test-ExchangeServerHealth.ps1 script. So I needed to find a way to still perform the test while avoiding the error.

The solution was found by using PowerShell remoting. I’ve written this proof of concept code to demonstrate how remoting can be used to get a result for Test-Mailflow.

Note this is demo code only and is not intended to be a functional script. I will be incorporating this code into Test-ExchangeServerHealth.ps1 in the near future.

Here is an example of the output.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server

3 comments

  1. Patrick Butler says:

    Intresting, so using this information I was able to configure mailflow in the Test-ExchangeServerHealth.ps1 by adding a variable $lserver = hostname and then in the mailflow adding/modifying
    $flow = Test-Mailflow $lserver -TargetMailboxServer $server -ErrorAction Stop

Leave a Reply

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