Exchange Client Access (CAS) connectivity testing script.

In this blog, I will review a script that I wrote to test the different Exchange Client Access (CAS) components.
Since the Exchange Client Access service relies on many different components, it might be difficult to run so many tests with different tools or scripts.
Therefore, I have created a single script which tests most of the CAS core components.

The script includes the following tests:

  • The script should run from Exchange Management Shell
  1. Ping test:
    In case the net connection (Ping test) result will be negative, which means that no response from the server will arrive, the script will NOT continue to all other tests on this server and will move on to the next server.

2. Health check of all the different virtual directories:
The second part will test each Exchange’s virtual directory -
MAPI, RPC, OAB, EWS, Autodiscover, OWA, ECP, Microsoft-Server-ActiveSync and PowerShell.
In case the virtual directory is responding, it will be marked with a green color.
In case one of the virtual directories is non-accessible, it will be marked with a red color.

3. Server’s components state.
This test checks the state (Active/InActive) of each component and endpoint on the server being checked.
In case a component is inActive state, it will be marked with green color. A component at InActive state will mark in red color.

4. Client Access ports: 80, 443, 444.
This test checks that the major client access connectivity ports are available and not blocked.
In case the port is accessible and open, it will be marked with green color.
blocked or inaccessible port will be marked in red color.

5. Certificates expiration tests.
This test checks if ANY certificate is expired or is about to expire.
In case a certificate is about to expire in 30 days or more, it will be marked with red color.

6. Certification binding existence.
On every Exchange server there are 2 websites:
- Default Web Site (for Client Access).
- Back End Website (used to proxy the client’s request and allow access to the database where his mailbox is located).
Each website has a bound certificate.
If a certificate was deleted or missing from the personal certificate store of the server, the website will be marked with a red color.

In case a certificate is bond to the website, the name of the website will be marked with a green color.

7. Application Pool tests.
This test verifies that all application pools on the server are at running state.
In case the application pool is at Running state, it will be marked with a green color.
If one or more application pools are at a Stopped state, they will be marked with a red color.

8. Mapi Connectivity tests.
This test uses the MapiConnectivity cmdlet to verifies that the MAPI server, Exchange store, and Directory Service Access are working.
In case the test is completed successfully, and all the components are working, a green message will appear on the console:

Any errors from the test will be displayed on the console.

The script’s output:

The script saves all the output from the console to a text file, which is pointed inside the script to C:\Scripts\ExchCasTest.Log

  • In case that you would like to change the path to a different location, just edit the script and change the path:

Start-Transcript -path “C:\Scripts\ExchCasTest.Log”

  • Each time you run the script, the log file content will be deleted, so only the last run will be documented inside the log.

The script

Click the link below to get the script:

During the last 13 years, I'm working as a Senior Customer Succes Engineer (former PFE) at Microsoft. My areas of expertise are Exchange, Powershell & Azure.