Many of us are familiar with troubleshooting the CAS services from outside our network using the Exchange Remote Connectivity Analyzer, but what about testing internally? Or testing specific virtual directories such as the ECP? There are some great built-in Powershell cmdlets that make troubleshooting the CAS much easier.
I would like to go through these one by one and show examples of each. More information can be seen by clicking each cmdlet below.
Before we get started, many of these cmdlets rely on utilizing a test mailbox. This mailbox is not created by default. If you try to run a cmdlet that requires the test mailbox, you will see the following error: MailboxNotFoundException

A script is available to help generate the test mailbox for you. From the Scripts folder where Exchange is installed, in my case C:\Program Files\Microsoft\Exchange Server\V14\Scripts\, run the New-TestCasConnectivityUser.ps1 script.

Now that the test mailbox is created, let’s look at the different cmdlets.
Test-ServiceHealth – This should be run first in any troubleshooting scenario. This script will list each Exchange role, what services are required for that role to function properly and which of those services are not running.

In my example, you will see that the Exchange Forms Based Authentication service is not started. After starting this from the services console, I run the cmdlet again and everything looks normal.

Test-MapiConnectivity – This is the next command that should be run to verify that mailbox access is working. Note that a | format-list can be added to any command to get more detailed information.

Test-OutlookConnectivity – Will verify that OWA is running and can be used to test all virtual directories or individual ones. In this example I am testing HTTP connectivity, TCP can also be specified.

Test-OutlookWebServices – Verifies the service information returned by Autodiscover for the Availability Service, Outlook Anywhere, OAB, and UM

Test-WebServicesConnectivity – Tests EWS functionality.

Test-EcpConnectivity – Verifies connectivity to the Exchange Control Panel.

Test-ActiveSyncConnectivity – Performs a full mailbox synchronization to verify health of ActiveSync

Test-PowerShellConnectivity – Test whether PowerShell remoting on a target CAS server is healthy

Also available are the Test-ImapConnectivity and Test-PopConnectivity if you are supporting those protocols. Always remember to use the Best Practices Analyzer report from the Toolbox as well.