It is important to regularly monitor the health of Exchange Server and its various services. This helps detect issues that may have serious repercussions if left unattended. To check the health status of the services and processes, Exchange Server offers a PowerShell command, named Get-HealthReport.
This command gives output of the specified server, the status, the set or process name, alert value of the process, and the monitor count. You can also script the command to automate the process. This will help you to immediately identify if a critical process is either offline or unhealthy. This is ideal to output the data in either API or monitoring system to get alerts via email or SMS to tackle the issue immediately. Below, we will see how to use the Get-HealthReport PowerShell command in Exchange Server.
Process to Use Get-HealthReport Command in Exchange Server
Before running the Get-HealthReport command, you need some basic permissions. To get the permissions and roles needed, run the following command.
As you can see (in the above image), the following roles are needed.
- View-Only Configuration
- O365SupportViewConfig
$Permissions | foreach {Get-ManagementRoleAssignment -Role $_.Name -Delegating $false | Format-Table -Auto Role,RoleAssigneeType,RoleAssigneeName}
From the output of this command (see the above image), you need to assign the role of Organization Management and the Server Management. You can assign these roles via PowerShell in the Exchange Management Shell (EMS) or the Exchange Admin Center (EAC).
After assigning the required roles and permissions, you can run the command (as given below) by specifying the Identity (the server name) of the Exchange Server.
The above command will return all the information on the specified Exchange Server.
If you don’t want the output of all the components of the Exchange Server, you can run the command with the FL parameter (see the below example).
This will load all the information. You can see the HealthSet parameter, which is the grouping of each component.
If you want to only show the OWA.Protocol.Dep, you can run the command as given below.
You can see the state as Not Applicable, Online, or Offline.
You can also dig deeper into the health set to identity what is wrong with a specific component that forms part of the set.
If you want to only know the service which is Unhealthy, Degraded, or Disabled, then you can use the Alert Value parameter with the command.
Once you identify that a health set is not healthy, you need to identify the problematic component in the health set. For this, you can run the following command. This will point you to the right process that is failing or unhealthy.
Get-HealthReport -Identity <server name> -HealthSet <name of set> | FT -autosize
I have looked to include some of the troubleshooting parts.
If there is problem with a specific database (showing the Unhealthy monitors), you cannot just delete the database. The reason for the problem would be limited space in the drive where the database is hosted.
If this is the case, an alternative is to disable the monitors using the Add-ServerMontioringOverride command (see the below example).
Add-ServerMonitoringOverride -ItemType Monitor -Identity "<health set>\<database name>" -PropertyValue 0 -PropertyName Enabled -Duration "60.00:00:00" -Server <server name>
Now, you will see the Alert Value as Healthy.
If the problem persists, you need to check the state of database using the ESEUtil command. If the database is in the Dirty Shutdown state, you can try to perform the Soft Recovery to fix small corruption issues. If it doesn’t work, then perform the Hard Recovery. However, this option will only be used as a last resort as it purges anything which is deemed as corrupted.
Conclusion
Above, we have discussed how to use the Get-HealthReport PowerShell command in Exchange Server. You can monitor various services and processes using this command. You can also use monitoring scripts to ensure that all processes are running successfully. You can also customize the Get-HealthReport command to get the health of specific services and processes.
If the server crashes or services are interrupted, then this can lead to database corruption. In such a case, you can use the native tools of Exchange Server, such as the ESEUtil. But there is no guarantee that the data will be recovered. Alternatively, you can take the help of Exchange repair tool, such as Stellar Repair for Exchange. This will help in getting the server and data up and running with less effort and in less time. The application can easily open corrupted EDB file from any version of Exchange Server and with no size limit. It allows to granularly export the EDB data to PST and other file formats. It can also export data from the EDB file directly to a live Exchange Server database or Office 365. It can export all the EDB file items, including user mailboxes, user archives, shared mailboxes, disabled mailboxes, and even public folders.