This is post 2 in a series of 3 Exchange mini health assessment posts. The CAS role mini heath check post can be found here. The Mailbox mini health assessment post can be found here.
This script provides a limited health assessment for the HUB Transport role. The script runs through 3 functional areas: core Exchange service status, Edge Sync Heath, and ExBPA (errors are exported to the report and warnings are displayed on screen). Once the data is collected, the results are exported to a simple HTML report.
Code Get-Date | Select-Object Date | convertTo-HTML -head $a -Title "HealthCheck" | Out-File c:HUBHealthReport.htm $a= "<script src=c:tempsorttable.js type=text/javascript></script>" $a = $a + "<style>" $a = $a + "BODY{background-color:#717d7d;}" $a = $a + "TABLE.sortable thead {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}" $a = $a + "TH{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:#827b60}" $a = $a + "TD{border-width: 1px;padding: 0px;border-style: solid;border-color: black;background-color:#c9c299}" $a = $a + "</style>" $HUBRole = Get-transportserver Foreach ($HUBServer in $HUBRole) { convertTo-HTML -head $a -Title "HUB Server Health Report" -Body "<H2>$HUBServer</H2>" | Out-File c:HUBHealthReport.htm -append test-servicehealth | select-object Role, {$_.ServicesRunning} | convertTo-HTML -body "<Font Color = Black><B>----------------- List Of Core Services That Are Running -----------------</B></Font Color>" | Out-File c:HUBHealthReport.htm -append test-servicehealth | select-object Role,{$_.ServicesNotRunning} | convertTo-HTML -Body "<Font Color = Black><B>----------------- List Of Core Services That Are Not Running -----------------</B></Font Color>" | Out-File c:HUBHealthReport.htm -append Test-EdgeSynchronization | convertTo-HTML -Body "<Font Color = Black><B>----------------- Test EDGE Sync ---------------------</B></Font Color>" | Out-File c:HUBHealthReport.htm -append Test-SystemHealth -ServerList $HUBServer -DownloadConfigurationUpdates:$False 2>&1 | convertTo-HTML -body "<Font Color = Black><B>----------------------- Overall System Health -----------------</B></Font Color>" | Out-File c:HUBHealthReport.htm -append }
Happy Exchanging!!!