Tuesday, May 30, 2017

Setting up Test-ExchangeServerHealth.ps1 PowerShell health check script in Task Scheduler to automatically run daily

One of the scripts I've used a lot over the past few years is the Test-ExchangeServerHealth.ps1 PowerShell health check script written by Paul Cunningham.  The red, yellow and green colour coded report generated by this script allows me to easily review the status of critical Exchange services on devices with small viewing space such as a smartphone.  If you are unfamiliar with this script, further details about the script can be found in the following links:

Test-ExchangeServerHealth.ps1 – PowerShell Script to Generate a Health Check Report for Exchange Server 2016/2013/2010
https://practical365.com/exchange-server/powershell-script-exchange-server-health-check-report/

Generate Health Report for an Exchange Server 2016/2013/2010 Environment
https://gallery.technet.microsoft.com/office/Generate-Health-Report-for-19f5fe5f

This script could be scheduled to automatically run via the Task Scheduler and this post serves to provide the configuration for the action which sometimes can be difficult to find.  Note that I won’t go into the details of creating the scheduled task as that could be found in one of my previous posts here:

Setting up vCheck PowerShell health check script in Task Scheduler to automatically run daily
http://terenceluk.blogspot.com/2017/03/setting-up-vcheck-powershell-health.html

The following is the syntax required to configure the action:

Program/script: powershell.exe

Add arguments (option): -command "& 'C:\PS-Scripts\Test-ExchangeServerHealth.ps1' -ReportMode -SendEmail"

clip_image002

No comments: