Powershell Script to check the Exchange Service Status

Powershell Script to check the Exchange Service Status

A simple power shell script to run test-servicehealth against all Exchange 2010 servers & get the result in the body of Email

$a=foreach ($server in Get-ExchangeServer){Test-ServiceHealth $server | ft $Server.name, Role, RequiredServicesRunning, ServicesNotRunning -auto}
Send-MailMessage -from Administrator@domain.com -to Recipient@domain.com -subject “Exchange Service Health Status for $((get-date -format “dd/MMM/yyyy”))” -body ($a | out-string) -smtpServer ‘SMTPServerName’

Save this as a ps1 file & use Task scheduler to trigger the script before start of business.

To add this in Task Scheduler, use below

C:WindowsSystem32WindowsPowerShellv1.0powershell.exe -command “. ‘C:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1′; Connect-ExchangeServer -auto; FolderpathTestServicehealth.ps1

About The Author

Related posts

Leave a Reply

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