Test-OutlookConnectivity cmdlet fails with Sequence contains no elements error in Exchange Server

Original KB number:   3186849

Symptoms

When you run the Test-OutlookConnectivity test in an Exchange Server 2016 or 2013 environment, you receive the following warning:

WARNING: An unexpected error has occurred and a Watson dump is being generated:  
Sequence contains no elements  
 + CategoryInfo : NotSpecified: (:) [Test-OutlookConnectivity], InvalidOperationException  
 + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Exchange.Management.Tasks.TestOutlookConnectivity  
 + PSComputerName : toys-e15-mbx1.tailspintoys.com  

Cause

This issue occurs because the database value that's specified in the ProbeIdentity parameter is case-sensitive.

Resolution

To resolve this issue, determine the database name value by running the Get-Mailbox cmdlet, as follows:

$db = (Get-Mailbox <Alias>).Database

Then, run the Test-OutlookConnecivity cmdlet by using the database variable from the preceding Get-Mailbox cmdlet:

Test-OutlookConnectivity OutlookRpcDeepTestprobe\$db -RunFromServerId <ServerName> -MailboxId <Alias>

More information

For more information about this PowerShell cmdlet, see Test-OutlookConnectivity.