Please come back for more

How to Get exchange health status

To get exchange health status first open exchange Powershell , run the command :

Get-MailboxDatabaseCopyStatus * | sort name | Select name,status,contentindexstate

 

If all the databases are mounted and the index state is healthy you are in a good state. To fix the index if not healthy :

Stop-Service MSExchangeFastSearch
Stop-Service HostControllerService
#get the path to the index file folder:
Get-MailboxDatabase glilyamDBNew | select EdbFilePath
#Delete the folder GuiD, The folder it self, Restarting the services will re-creat it

Start-Service MSExchangeFastSearch
Start-Service HostControllerService

Test-ExchangeServerHealth.ps1 script will Perform a series of health checks on the specified Exchange servers
and outputs the results to screen, and optionally to log file, HTML report, and HTML email.

Test-ExchangeServerHealth.ps1 download:  https://gallery.technet.microsoft.com/scriptcenter/Generate-Health-Report-for-19f5fe5f/file/133621/6/Test-ExchangeServerHealth.ps1

MOre information about implementation :  https://github.com/cunninghamp/Test-ExchangeServerHealth.ps1

 

Examples:

.\Test-ExchangeServerHealth.ps1

Checks all servers in the organization and outputs the results to the shell window.

.\Test-ExchangeServerHealth.ps1 -Server Your_Server_Name

Checks the server and outputs the results to the shell window.

.\Test-ExchangeServerHealth.ps1 -ReportMode -SendEmail

Checks all servers in the organization, outputs the results to the shell window, a HTML report, and emails the HTML report to the address configured in the script.

If you use the report mode you’ll get a HTML file containing the health check results, and/or an email to your designated address if you also use the send email option.

For the email functionality to work please update these variables in the script to suit your environment.

#...................................
# Modify these Email Settings
#...................................

$smtpsettings = @{
	To =  "administrator@exchangeserverpro.net"
	From = "exchangeserver@exchangeserverpro.net"
	Subject = "Exchange Server Health Report - $now"
	SmtpServer = "smtp.exchangeserverpro.net"
	}
A lot of people ask how to add multiple recipients to the SMTP settings. My advice is to use a distribution group, so that any time you need to modify the list of recipients you can simply change the distribution group membership instead of needing to modify the script code.

When running the script on non-English servers you can modify the following variables in the script to match your language so that the script does not give errors or incorrect results.

#...................................
# Modify these language 
# localization strings.
#...................................

# The server roles must match the role names you see when you run Test-ServiceHealth.
$casrole = "Client Access Server Role"
$htrole = "Hub Transport Server Role"
$mbrole = "Mailbox Server Role"
$umrole = "Unified Messaging Server Role"

# This should match the word for "Success", or the result of a successful Test-MAPIConnectivity test
$success = "Success"

For example, a German system would use the following values:

# The server roles must match the role names you see when you run Test-ServiceHealth.
$casrole = "Clientzugriffs-Serverrolle"
$htrole = "Hub-Transport-Serverrolle"
$mbrole = "Postfachserverrolle"
$umrole = "Unified Messaging-Serverrolle"

# This should match the word for "Success", or the result of a successful Test-MAPIConnectivity test
$success = "Erfolgreich"

Use the ignorelist.txt file to specify the names of any servers, DAGs, or databases that you want to ignore for the tests.

My scheduled task settings for this script are:

  • Run whether user is logged on or not
  • Run with highest privileges
  • Action: Start a program
    • Program: powershell.exe
    • Arguments: -command “C:\Scripts\ExchangeServerHealth\Test-ExchangeServerHealth.ps1 -Log -SendEmail”

Leave a Reply

Your email address will not be published. Required fields are marked *