Export (0) Print
Expand All
Expand Minimize

Test-Mailflow

 

Applies to: Exchange Server 2013

Topic Last Modified: 2014-05-09

This cmdlet is available only in on-premises Exchange Server 2013.

Use the Test-Mailflow cmdlet to diagnose whether mail can be successfully sent from and delivered to the system mailbox on a Mailbox server. You can also use this cmdlet to verify that email is sent between Mailbox servers within a defined latency threshold.

Test-Mailflow -AutoDiscoverTargetMailboxServer <SwitchParameter> [-Identity <ServerIdParameter>] <COMMON PARAMETERS>
Test-Mailflow -TargetEmailAddress <String> [-Identity <ServerIdParameter>] [-TargetEmailAddressDisplayName <String>] <COMMON PARAMETERS>
Test-Mailflow [-Identity <ServerIdParameter>] <COMMON PARAMETERS>
Test-Mailflow -TargetDatabase <DatabaseIdParameter> [-Identity <ServerIdParameter>] <COMMON PARAMETERS>
Test-Mailflow -TargetMailboxServer <ServerIdParameter> [-Identity <ServerIdParameter>] <COMMON PARAMETERS>
Test-Mailflow -CrossPremises <$true | $false> [-CrossPremisesExpirationTimeout <EnhancedTimeSpan>] [-CrossPremisesPendingErrorCount <Int32>] <COMMON PARAMETERS>
COMMON PARAMETERS: [-ActiveDirectoryTimeout <Int32>] [-Confirm [<SwitchParameter>]] [-DomainController <Fqdn>] [-ErrorLatency <Int32>] [-ExecutionTimeout <Int32>] [-MonitoringContext <$true | $false>] [-WhatIf [<SwitchParameter>]]

This example tests message flow from the server name Mailbox1 to the server named Mailbox2. Note that you need to run this command while connected to Mailbox1.

Test-Mailflow Mailbox1 -TargetMailboxServer Mailbox2

This example tests message flow from the local Mailbox server where you're running this command to the email address john@contoso.com.

Test-Mailflow -TargetEmailAddress john@contoso.com

The Test-Mailflow cmdlet tests mail submission, transport, and delivery. The cmdlet verifies that each Mailbox server can successfully send itself a message. You can also use this cmdlet to verify that the system mailbox on one Mailbox server can successfully send a message to the system mailbox on another Mailbox server. A system mailbox is required on all servers that are involved in the test.

The test messages are available in the target user or system mailbox. The message subject is Test-Mailflow <GUID>, and the message body contains the text This is a Test-Mailflow probe message.

The Test-Mailflow results are displayed on-screen. The interesting values in the results are:

  • TestMailflowResult   The values returned are typically Success or *FAILURE*.

  • MessageLatencyTime   The time required to complete the test (deliver the test message). The value uses the syntax hh:mm:ss.ffff where hh = hours, mm = minutes, ss = seconds and ffff = fractions of a second.

You can write the Test-Mailflow results to a file by piping the output to ConvertTo-Html or ConvertTo-Csv and adding "> <filename>" to the command. For example:

Test-Mailflow -AutoDiscoverTargetMailboxServer | ConvertTo-Csv > "C:\My Documents\test-mailflow 2014-05-01.csv"

You need to be assigned permissions before you can run this cmdlet. Although all parameters for this cmdlet are listed in this topic, you may not have access to some parameters if they're not included in the permissions assigned to you. To see what permissions you need, see the "Testing mail flow" entry in the Mail flow permissions topic.

 

Parameter Required Type Description

AutoDiscoverTargetMailboxServer

Required

System.Management.Automation.SwitchParameter

The AutoDiscoverTargetMailboxServer switch specifies whether to automatically populate a list of target Mailbox servers to which to send a test message. The task queries Active Directory to discover all Mailbox servers and then sends each server a test message.

When you use this switch, you can't use the CrossPremises, TargetDatabase, TargetEmailAddress or TargetMailboxServer parameters.

CrossPremises

Required

System.Boolean

The CrossPremises parameter specifies whether the mail flow test will be conducted in cross-premises mode.

Set this parameter to $true if your organization is using a cross-premises deployment and you want to verify cross-premises mail flow.

When you use this parameter, you can't use the AutoDiscoverTargetMailboxServer, TargetDatabase, TargetEmailAddress or TargetMailboxServer parameters.

TargetDatabase

Required

Microsoft.Exchange.Configuration.Tasks.DatabaseIdParameter

The TargetDatabase parameter specifies the mailbox database to which test messages are sent.

When you use this parameter, you can't use the AutoDiscoverTargetMailboxServer, CrossPremises, TargetEmailAddress or TargetMailboxServer parameters.

TargetEmailAddress

Required

System.String

The TargetEmailAddress parameter specifies the SMTP address of the mailbox to which test messages are sent. Use this parameter to send test messages to a Mailbox server in a remote forest. If this parameter is used, the test is always a remote test.

When you use this parameter, you can't use the AutoDiscoverTargetMailboxServer, CrossPremises, TargetDatabase or TargetMailboxServer parameters.

TargetMailboxServer

Required

Microsoft.Exchange.Configuration.Tasks.ServerIdParameter

The TargetMailboxServer parameter specifies one or more Mailbox servers in the local Exchange organization to which test messages are sent.

When you use this parameter, you can't use the AutoDiscoverTargetMailboxServer, CrossPremises, TargetDatabase or TargetEmailAddress parameters.

ActiveDirectoryTimeout

Optional

System.Int32

The ActiveDirectoryTimeout parameter specifies the number of seconds that elapse before the task provides an informational message about the delay. The default value is 15 seconds.

Confirm

Optional

System.Management.Automation.SwitchParameter

The Confirm switch causes the command to pause processing and requires you to acknowledge what the command will do before processing continues. You don't have to specify a value with the Confirm switch.

CrossPremisesExpirationTimeout

Optional

Microsoft.Exchange.Data.EnhancedTimeSpan

The CrossPremisesExpirationTimeout parameter is used when this cmdlet is run by Microsoft System Center Operations Manager 2007 agents for asynchronous monitoring. We don't recommend using this parameter when running this cmdlet manually.

CrossPremisesPendingErrorCount

Optional

System.Int32

The CrossPremisesPendingErrorCount parameter is used when this cmdlet is run by System Center Operations Manager 2007 agents for asynchronous monitoring. We don't recommend using this parameter when running this cmdlet manually.

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

The DomainController parameter specifies the fully qualified domain name (FQDN) of the domain controller that retrieves data from Active Directory.

ErrorLatency

Optional

System.Int32

The ErrorLatency parameter specifies how long to wait for a test message to be delivered before an error event is logged in Microsoft System Center Operations Manager 2007. The default value when a test message is sent to the local Mailbox server is 15 seconds and 180 seconds when a test message is sent to a remote Mailbox server.

ExecutionTimeout

Optional

System.Int32

The ExecutionTimeout parameter specifies the maximum time that this task can run before the test is determined to be a failure. If no test message or delivery report arrives before this time expires, the task ends and an error is reported. When the task is run in the Exchange Management Shell, the default setting is 240 seconds. When the MonitoringContext parameter is used, the default setting is 15 seconds.

Identity

Optional

Microsoft.Exchange.Configuration.Tasks.ServerIdParameter

The Identity parameter specifies the source Mailbox server name from which a test message is sent. If you don't use this parameter, the local Mailbox server is used.

MonitoringContext

Optional

System.Boolean

The MonitoringContext parameter includes or excludes the associated monitoring events and performance counters in the results. Valid input for this parameter is $true or $false. The default value is $false. If you specify the value $true, the monitoring events and performance counters are included in the command results. Typically, you include the monitoring events and performance counters in the results when the output is passed to Microsoft System Center Operations Manager 2007 or System Center 2012 - Operations Manager.

TargetEmailAddressDisplayName

Optional

System.String

The TargetEmailAddressDisplayName parameter specifies a custom display name that's used on events and reports in Microsoft System Center Operations Manager 2007 when the TargetEmailAddress parameter is used. If you don't use the TargetEmailAddressDisplayName parameter, the events and reports use the email address value specified by the TargetEmailAddress parameter.

This parameter is available only with the TargetEmailAddress parameter, and has no effect on the output of the cmdlet outside of Microsoft System Center Operations Manager.

WhatIf

Optional

System.Management.Automation.SwitchParameter

The WhatIf switch instructs the command to simulate the actions that it would take on the object. By using the WhatIf switch, you can view what changes would occur without having to apply any of those changes. You don't have to specify a value with the WhatIf switch.

To see the input types that this cmdlet accepts, see Cmdlet Input and Output Types. If the Input Type field for a cmdlet is blank, the cmdlet doesn’t accept input data.

To see the return types, which are also known as output types, that this cmdlet accepts, see Cmdlet Input and Output Types. If the Output Type field is blank, the cmdlet doesn’t return data.

 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft