Others

How to Fix PowerShell Parser Errors in Exchange Server Health Script

Adam DavisAdam Davis Oct 23, 2026 870 views

Question details

The user needs to fix parser errors encountered when running the Test-ExchangeServerHealth.ps1 script.

Product
Exchange Server
Device & OS
not provided
Scenario
Running a third-party health check script on Exchange Server 2016 CU22.
Observed behavior
The script throws errors related to unusual characters, HTML entities, missing string terminators, unexpected tokens, and missing closing braces.
Before you start

Ensure you have downloaded the script as a raw .ps1 file rather than copying text directly from a web page, as web formatting is the most common cause of HTML entity and syntax errors.

Solution 1Recommended

Download and Execute a Clean Copy of the Script

Since Test-ExchangeServerHealth.ps1 is not a built-in script, downloading a fresh, uncorrupted copy directly resolves parser and syntax errors.

Errors involving missing braces and unexpected tokens typically indicate that the script file was damaged during download or improperly copied.

1
Obtain a valid copy

Download the Test-ExchangeServerHealth.ps1 script directly from its official repository, ensuring you download the raw file format.

2
Place on the Exchange Server

Extract the downloaded file locally and move it to a known directory on your Exchange Server.

3
Open Exchange Management Shell

Launch the Exchange Management Shell (EMS) on your server with administrator privileges.

4
Navigate and execute

Navigate to the folder where you placed the script and run it by typing .\Test-ExchangeServerHealth.ps1 -ReportMode and pressing Enter.

Download and Execute a Clean Copy of the Script
Community Support: If errors persist, consult the Microsoft Office Exchange Server Administration Q&A forum for advanced troubleshooting.
Free Microsoft Office alternative

Document Your IT Infrastructure with WPS Office

While WPS Office cannot execute PowerShell scripts, it is the perfect free alternative to Microsoft Office for writing server documentation and analyzing exported CSV health reports. It is lightweight, free, and completely compatible with Microsoft formats.

  1. 1. Download WPS Office: Visit the official WPS website to download the free installer.
  2. 2. Install the Software: Run the downloaded executable and follow the quick on-screen instructions.
  3. 3. Open and Edit Reports: Launch WPS Office to easily manage your server's exported CSV and PDF health reports.
Seamlessly open, edit, and analyze exported CSV server health reports.High compatibility with Microsoft Word, Excel, and PowerPoint formats.Lightweight installation ensures fast loading on admin workstations.All-in-one free suite for managing PDF, Word, Excel, and PPT files.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my PowerShell script show HTML entity errors?

This usually happens if the script was copied and pasted from a web browser instead of being downloaded as a raw file, causing hidden HTML tags and formatted characters to be saved inside the .ps1 file.

Is Test-ExchangeServerHealth.ps1 a Microsoft built-in tool?

No, Test-ExchangeServerHealth.ps1 is a third-party, community-created script used by Exchange administrators. It is not natively included with Exchange Server installations.

How do I generate a health report after fixing the script?

Once the fresh script is correctly placed on your server, open the Exchange Management Shell, navigate to the script's directory, and run the command with the -ReportMode switch to generate the summary.