Applies to: Exchange Server 2007
Topic Last Modified: 2007-06-11

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

Syntax

Test-Mailflow [-Identity <ServerIdParameter>] [-ActiveDirectoryTimeout <Int32>] [-DomainController <Fqdn>] [-ErrorLatency <Int32>] [-ExecutionTimeout <Int32>] [-MonitoringContext <$true | $false>]
Test-Mailflow [-Identity <ServerIdParameter>] -TargetEmailAddress <String> [-ActiveDirectoryTimeout <Int32>] [-DomainController <Fqdn>] [-ErrorLatency <Int32>] [-ExecutionTimeout <Int32>] [-MonitoringContext <$true | $false>] [-TargetEmailAddressDisplayName <String>]
Test-Mailflow [-Identity <ServerIdParameter>] -TargetMailboxServer <ServerIdParameter> [-ActiveDirectoryTimeout <Int32>] [-DomainController <Fqdn>] [-ErrorLatency <Int32>] [-ExecutionTimeout <Int32>] [-MonitoringContext <$true | $false>]
Test-Mailflow [-Identity <ServerIdParameter>] -AutoDiscoverTargetMailboxServer <SwitchParameter> [-ActiveDirectoryTimeout <Int32>] [-DomainController <Fqdn>] [-ErrorLatency <Int32>] [-ExecutionTimeout <Int32>] [-MonitoringContext <$true | $false>]
Test-Mailflow [-ActiveDirectoryTimeout <Int32>] [-DomainController <Fqdn>] [-ErrorLatency <Int32>] [-ExecutionTimeout <Int32>] [-MonitoringContext <$true | $false>]

Parameters

Parameter Required Type Description

AutoDiscoverTargetMailboxServer

Required

System.Management.Automation.SwitchParameter

The AutoDiscoverTargetMailboxServer parameter automatically populates a list of target Mailbox servers to which to send a test message. The task queries the Active Directory directory service to discover all Mailbox servers and then send each server a test message.

TargetEmailAddress

Required

System.String

The TargetEmailAddress parameter specifies the Simple Mail Transfer Protocol (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.

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.

ActiveDirectoryTimeout

Optional

System.Int32

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

DomainController

Optional

Microsoft.Exchange.Data.Fqdn

Use the DomainController parameter to specify the fully qualified domain name (FQDN) of the domain controller that this command will bind to and that will write this change to 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 MOM. 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 or source mailbox SMTP address from which a test message is sent. The default value is the local Mailbox server.

MonitoringContext

Optional

System.Boolean

The MonitoringContext parameter is used only when MOM is being used for server monitoring. If you set the value to $true, the cmdlet populates the MonitoringContext object with events and performance counters that are used by MOM. The default value of this parameter is $false.

TargetEmailAddressDisplayName

Optional

System.String

The TargetEmailAddressDisplayName parameter specifies the display name of the mailbox to which test messages are sent.

Detailed Description

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 mailbox on one Mailbox server can successfully send a message to the System Mailbox mailbox on another Mailbox server.

This task provides useful information to the administrator when it is run manually. It can also be called by monitoring tools, such as Microsoft Operations Manager (MOM), Exchange Best Practices Analyzer, and Exchange Troubleshooting Assistant. When the task is called by MOM, alerts are generated to indicate failures or slow performance.

The Test-Mailflow cmdlet can perform a local test or a remote test. If you do not specify any parameters, a local test is performed and the server sends a test e-mail message to itself. When the TargetEmailAddress, TargetMailboxServer, or AutoDiscoverTargetMailboxServer parameter is specified, a remote test is performed. The TargetEmailAddress, TargetMailboxServer, and AutoDiscoverTargetMailboxServer parameters are mutually exclusive.

To test e-mail delivery for a cross-forest scenario, use the TargetEmailAddress parameter. To test e-mail delivery between Mailbox servers in the same Active Directory forest, use the TargetMailboxServer parameter. To automatically populate the list of target servers on which to test mail flow, use the AutoDiscoverTargetMailboxServer parameter.

If more than one of these parameters is specified, the AutoDiscoverTargetMailboxServer parameter takes precedence over the TargetEmailAddress and TargetMailboxServer parameters. The TargetMailboxServer parameter takes precedence over the TargetEmailAddress parameter. If a local test is performed, the local server must have a System Mailbox mailbox for each mailbox database. If a remote test is performed, the source and destination servers must both have a System Mailbox mailbox or a specific mailbox must be provided by using parameters.

To run the Test-Mailflow cmdlet, the account you use must be delegated the following:

  • Exchange Server Administrator role and local Administrators group for the server where the cmdlet is run.

For more information about permissions, delegating roles, and the rights that are required to administer Microsoft Exchange Server 2007, see Permission Considerations.

Input Types

Return Types

The Test-Mailflow cmdlet returns the following properties to help you troubleshoot mail-flow problems:

  • MailFlowResult   This property displays either Success or Failure.

  • MessageLatencyTime   This property displays the time in seconds that it took for a test message to be sent to the receiving Mailbox server.

  • IsRemoteTest   This property indicates whether the test message was sent to a server other than the local Mailbox server, or if the test message was sent to an e-mail address.

Errors

Error Description

 

Exceptions

Exceptions Description

 

Example

The first example shows how to send a test message from the server Mailbox1 to the server Mailbox2.

The second example shows how to send a test message from the server Mailbox1 to the e-mail address john@contoso.com. In this example, the test message is being sent to a Mailbox server in a remote forest.

Copy Code
Test-Mailflow Mailbox1 -TargetMailboxServer Mailbox2
Test-Mailflow Mailbox1 -TargetEmailAddress john@contoso.com