Hello Michael,
Find the modified script below. You can launch the script in Adaxes using a Custom Command with a Run a program or PowerShell script action. When the script completes its job, it sends the results to the user how executes the Custom Command.
Also, if you want to launch the script form Adaxes Web Interface, you can create a Home Page Action that will launch the Custom Command. To evade the object selection page when executing the Custom Command from the Web Interface, you can set up the Home Page Action to always execute for the current user.
To create the Custom Command:
- Create a new Custom Command.
- On the 2nd step of the Create Custom Command wizard, select User.
- On the 3rd step of the wizard, add the Run a program or PowerShell script action and paste the modified PowerShell script that you may find below.
- Finish creation of the Custom Command.
To create the Customized Home Page Action:
- On the computer, where the Web Interface is installed, start the Web Interface Customization tool.
- In the Interface type drop-down list, select the Web Interface you want to configure.
- Activate the General tab, select the Actions pane option, and click Configure Home Page Actions.
- In the dialog box that appears, click Add...
- On the 1st step of the Add Home Page Action wizard that appears, select Custom Command.
- Select the Custom Command that you created in the drop-down list that appears next to the Custom Command option.
- On the 3rd step of the wizard, select Always perform for the current user to evade the object selection page.
- Click Finish.
Here's the modified script that can be used in a Custom Command:
$server = $False # TODO: modify me
# Set to $False to check all servers in the organization.
# If you want to check a specific server, specify the flat name of the computer where the Exchange
# Server is located in double quotes. For example, $server = "EXCHSERVER"
$now = Get-Date # Used for timestamps
$date = $now.ToShortDateString() # Short date format for email message subject
$smtpTo = $Context.Initiator.UserAdsObject.Get("mail") # To send emails to the operation initiator
$messagesubject = "Exchange Server Health Check - $date"
#...................................
# Initialize
#...................................
#Add Exchange 2010 snapin
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue
#Set recipient scope
if (!(Get-ADServerSettings).ViewEntireForest)
{
Set-ADServerSettings -ViewEntireForest $true -WarningAction SilentlyContinue
}
#...................................
# Variables
#...................................
[array]$exchangeservers = @() # Array for the Exchange server or servers to check
[int]$transportqueuehigh = 100 # Change this to set transport queue high threshold
[int]$transportqueuewarn = 80 # Change this to set transport queue warning threshold
$mapitimeout = 20 # Timeout for each MAPI connectivity test, in seconds
$ip = $null
[array]$summaryreport = @()
[array]$report = @()
#...................................
# Error/Warning Strings
#...................................
$string0 = "Server is not an Exchange server. "
$string1 = "Server is not reachable by ping. "
$string3 = "------ Checking"
$string4 = "Could not test service health. "
$string5 = "Required services not running. "
$string6 = "Could not check queue. "
$string7 = "Public Folder database not mounted. "
$string8 = "Skipping Edge Transport server. "
$string9 = "Mailbox databases not mounted. "
$string10 = "MAPI tests failed. "
$string11 = "Mail flow test failed. "
$string12 = "No Exchange Server 2003 checks performed. "
$string13 = "Server not found in DNS. "
#...................................
# Script
#...................................
# Check if a single server was specified
if ($server)
{
# Run for single specified server
try
{
$exchangeservers = Get-ExchangeServer $server -ErrorAction Stop
}
catch
{
# Couldn't find Exchange server of that name
$Context.LogMessage($_.Exception.Message, "Warning")
# Exit because single server was specified and couldn't be found in the organization
EXIT
}
}
else
{
# This is the list of server names to never alert for
$ignorelist = @()
$tmpservers = @(Get-ExchangeServer)
# Remove the servers that are ignored from the list of servers to check
foreach ($tmpserver in $tmpservers)
{
if (!($ignorelist -icontains $tmpserver.name))
{
$exchangeservers = $exchangeservers += $tmpserver
}
}
}
# Begin the health checks
foreach ($server in $exchangeservers)
{
$log = $string3 + " " + $server + "<br/>"
# Find out some details about the server
try
{
$roles = Get-ExchangeServer $server -ErrorAction Stop
}
catch
{
$log += '<font color="Orange">' + $_.Exception.Message + " </font> <br/>"
$roles = $null
}
if ($roles -eq $null )
{
# Server is not an Exchange server
$log += '<font color="Orange">' + $string0 + '</font><br/>'
}
elseif ( $roles.IsEdgeServer )
{
$log += $string8 + '<br/>'
}
else
{
# Server is an Exchange server, continue the health check
# Custom object properties
$serverObj = New-Object PSObject
$serverObj | Add-Member NoteProperty -Name "Server" -Value $server
$serverObj | Add-Member NoteProperty -Name "Site" -Value $server.site.name
$serverObj | Add-Member NoteProperty -Name "DNS" -Value $null
$serverObj | Add-Member NoteProperty -Name "Ping" -Value $null
$serverObj | Add-Member NoteProperty -Name "Uptime (hrs)" -Value $null
$serverObj | Add-Member NoteProperty -Name "Version" -Value $null
$serverObj | Add-Member NoteProperty -Name "Roles" -Value $null
$serverObj | Add-Member NoteProperty -Name "CA Services" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "HT Services" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "MB Services" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "UM Services" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "Transport Queue" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "PF DBs Mounted" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "MB DBs Mounted" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "Mail Flow Test" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "MAPI Test" -Value "n/a"
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ""
$serverObj | Add-Member NoteProperty -Name "Warning Details" -Value ""
# Check server name resolves in DNS
$log += "DNS Check: "
try
{
$ip = [System.Net.Dns]::GetHostByName($server).AddressList | Select-Object IPAddressToString -ExpandProperty IPAddressToString
}
catch
{
$log += '<font color="Orange">' + $_.Exception.Message + ' </font><br/>'
$ip = $null
}
finally {}
if ( $ip -ne $null )
{
$log += '<font color="Green">Pass </font><br/>'
$serverObj | Add-Member NoteProperty -Name "DNS" -Value "Pass" -Force
# Is server online
$log += "Server up: "
$ping = new-object System.Net.NetworkInformation.Ping
$result = $ping.send($ip)
if ($result.status.ToString() –eq "Success")
{
$log += '<font color="Green">Pass </font><br/>'
$serverObj | Add-Member NoteProperty -Name "Ping" -Value "Pass" -Force
# Uptime check
$uptime = $null
$laststart = $null
try
{
$laststart = [System.Management.ManagementDateTimeconverter]::ToDateTime((Get-WmiObject -Class Win32_OperatingSystem -computername $server -ErrorAction Stop).LastBootUpTime)
}
catch
{
$log += '<font color="Orange">' + $_.Exception.Message + ' </font><br/>'
}
finally {}
if ($laststart -eq $null)
{
[string]$uptime = "Unable to retrieve uptime"
}
else
{
[int]$uptime = (New-TimeSpan $laststart $now).TotalHours
[int]$uptime = "{0:N0}" -f $uptime
}
$log += "Uptime (hrs): "
Switch ($uptime -gt 23) {
$true { $log += '<font color="Green">' + $uptime + '</font><br/>' }
$false { $log += '<font color="Orange">' + $uptime + '</font><br/>' }
default { $log += '<font color="Orange">' + $uptime + '</font><br/>' }
}
$serverObj | Add-Member NoteProperty -Name "Uptime (hrs)" -Value $uptime -Force
# Determine the friendly version number
$ExVer = $roles.AdminDisplayVersion
$log += "Server version: "
if ($ExVer -like "Version 6.*")
{
$version = "Exchange 2003"
}
if ($ExVer -like "Version 8.*")
{
$version = "Exchange 2007"
}
if ($ExVer -like "Version 14.*")
{
$version = "Exchange 2010"
}
$log += $version + '<br/>'
$serverObj | Add-Member NoteProperty -Name "Version" -Value $version -Force
if ($version -eq "Exchange 2003")
{
$log += $string12 + '<br/>'
$report = $report + $serverObj
}
if ($version -eq "Exchange 2007" -or $version -eq "Exchange 2010")
{
# START - Exchange 2007/2010 Health Checks
$log += 'Roles:' + $roles.ServerRole + '<br/>'
$serverObj | Add-Member NoteProperty -Name "Roles" -Value $roles.ServerRole -Force
$IsEdge = $roles.IsEdgeServer
$IsHub = $roles.IsHubTransportServer
$IsCAS = $roles.IsClientAccessServer
$IsMB = $roles.IsMailboxServer
# START - General Server Health Check
# Skipping Edge Transports for the general health check, as firewalls usually get
# in the way. If you want to include then, remove this If.
if ($IsEdge -ne $true)
{
# Service health is an array due to how multi-role servers return Test-ServiceHealth status
try {
$servicehealth = @(Test-ServiceHealth $server -ErrorAction Stop)
}
catch {
$serverObj | Add-Member NoteProperty -Name "Warning Details" -Value ($($serverObj."Warning Details") + $string4) -Force
$log += '<font color="Orange">' + $uptime + $string4 + '</font><br/>'
}
if ($servicehealth)
{
foreach($s in $servicehealth)
{
switch ($s.Role)
{
"Client Access Server Role" { $roleservices = "CA Services" }
"Hub Transport Server Role" { $roleservices = "HT Services" }
"Mailbox Server Role" { $roleservices = "MB Services" }
"Unified Messaging Server Role" { $roleservices = "UM Services" }
}
$log += $s.Role + 'Services: '
switch ($s.RequiredServicesRunning)
{
$true { $svchealth = "Pass"; $log += '<font color="Green">Pass</font><br/>' }
$false {$svchealth = "Fail"; $log += '<font color="Red">Fail</font><br/>'; $serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string5) -Force }
}
$serverObj | Add-Member NoteProperty -Name $roleservices -Value $svchealth -Force
}
}
}
# END - General Server Health Check
# START - Hub Transport Server Check
if ($IsHub)
{
$q = $null
$log += "Total Queue: "
try {
$q = Get-Queue -server $server -ErrorAction Stop
}
catch {
$serverObj | Add-Member NoteProperty -Name "Warning Details" -Value ($($serverObj."Warning Details") + $string6) -Force
$log += '<font color="Orange">' + $string6 + '</font><br/>'
$log += '<font color="Orange">' + $_.Exception.Message + " </font><br/>"
}
if ($q)
{
$qcount = $q | Measure-Object MessageCount -Sum
[int]$qlength = $qcount.sum
if ($qlength -le $transportqueuewarn)
{
$log += '<font color="Green">' + $qlength + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Transport Queue" -Value "Pass" -Force
}
elseif ($qlength -gt $transportqueuewarn -and $qlength -lt $transportqueuehigh)
{
$log += '<font color="Orange">' + $qlength + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Transport Queue" -Value "Warn" -Force
}
else
{
$log += '<font color="Red">' + $qlength + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Transport Queue" -Value "Fail" -Force
}
}
else
{
$serverObj | Add-Member NoteProperty -Name "Transport Queue" -Value "Unknown" -Force
}
}
# END - Hub Transport Server Check
# START - Mailbox Server Check
if ($IsMB)
{
# Get the PF and MB databases
[array]$pfdbs = @(Get-PublicFolderDatabase -server $server -status -WarningAction SilentlyContinue)
[array]$mbdbs = @(Get-MailboxDatabase -server $server -status | Where {$_.Recovery -ne $true})
[array]$activedbs = @(Get-MailboxDatabase -status | Where {$_.MountedOnServer -eq ($server.fqdn)})
# START - Database Mount Check
# Check public folder databases
if ($pfdbs.count -gt 0)
{
$log += "Public Folder databases mounted: "
[string]$pfdbstatus = "Pass"
[array]$alertdbs = @()
foreach ($db in $pfdbs)
{
if (($db.mounted) -ne $true)
{
$pfdbstatus = "Fail"
$alertdbs += $db.name
}
}
$serverObj | Add-Member NoteProperty -Name "PF DBs Mounted" -Value $pfdbstatus -Force
if ($alertdbs.count -eq 0)
{
$log += '<font color="Green">' + $pfdbstatus + '</font><br/>'
}
else
{
$log += '<font color="Red">' + $pfdbstatus + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string7) -Force
$log += "Offline databases: <br/>"
foreach ($al in $alertdbs)
{
$log += '<font color="Red">' + $al + '</font><br/>'
}
}
}
# Check mailbox databases
if ($mbdbs.count -gt 0)
{
[string]$mbdbstatus = "Pass"
[array]$alertdbs = @()
$log += "Mailbox databases mounted: "
foreach ($db in $mbdbs)
{
if (($db.mounted) -ne $true)
{
$mbdbstatus = "Fail"
$alertdbs += $db.name
}
}
$serverObj | Add-Member NoteProperty -Name "MB DBs Mounted" -Value $mbdbstatus -Force
if ($alertdbs.count -eq 0)
{
$log += '<font color="Green">' + $mbdbstatus + '</font><br/>'
}
else
{
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string9) -Force
$log += '<font color="Green">' + $mbdbstatus + '</font><br/>'
$log += "Offline databases: "
foreach ($al in $alertdbs)
{
$log += '<font color="Red">' + $al + '</font><br/>'
}
}
}
# END - Database Mount Check
# START - MAPI Connectivity Test
if ($activedbs.count -gt 0 -or $pfdbs.count -gt 0)
{
[string]$mbdbstatus = "Pass"
[array]$alertdbs = @()
$log += "MAPI connectivity: "
foreach ($db in $mbdbs)
{
$mapistatus = Test-MapiConnectivity -Database $db -PerConnectionTimeout $mapitimeout
if (($mapistatus.Result.Value) -ne "Success")
{
$mbdbstatus = "Fail"
$alertdbs += $db.name
}
}
$serverObj | Add-Member NoteProperty -Name "MAPI Test" -Value $mbdbstatus -Force
if ($alertdbs.count -eq 0)
{
$log += '<font color="Green">' + $mbdbstatus + '</font><br/>'
}
else
{
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string10) -Force
$log += '<font color="Red">' + $mbdbstatus + '</font><br/>'
$log += "MAPI failed to: <br/>"
foreach ($al in $alertdbs)
{
$log += '<font color="Red">' + $al + '</font><br/>'
}
}
}
# END - MAPI Connectivity Test
# START - Mail Flow Test
if ($activedbs.count -gt 0 -or $version -eq "Exchange 2007")
{
$flow = $null
$testmailflowresult = $null
$log += "Mail flow test: "
try
{
$flow = Test-Mailflow $server -ErrorAction Stop
}
catch
{
$testmailflowresult = $_.Exception.Message
}
if ($flow)
{
$testmailflowresult = $flow.testmailflowresult
}
if ($testmailflowresult -eq "Success")
{
$log += '<font color="Green">' + $testmailflowresult + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Mail Flow Test" -Value "Pass" -Force
}
else
{
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string11) -Force
$log += '<font color="Red">' + $testmailflowresult + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Mail Flow Test" -Value "Fail" -Force
}
}
else
{
$log += "Mail flow test: No active mailbox databases <br/>"
}
# END - Mail Flow Test
}
# END - Mailbox Server Check
}
# END - Exchange 2007/2010 Health Checks
$report = $report + $serverObj
}
else
{
# Server is not up
$log += '<font color="Orange">' + $string1 + '</font><br/>'
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string1) -Force
$serverObj | Add-Member NoteProperty -Name "Ping" -Value "Fail" -Force
$report = $report + $serverObj
}
}
else
{
$log += '<font color="Red">Fail </font><br/>'
$log += '<font color="Orange">' + $string13 + " </font><br/>"
$serverObj | Add-Member NoteProperty -Name "Error Details" -Value ($($serverObj."Error Details") + $string13) -Force
$serverObj | Add-Member NoteProperty -Name "DNS" -Value "Fail" -Force
$report = $report + $serverObj
}
}
}
# Generate the report
# Get report generation timestamp
$reportime = Get-Date
# Generate report summary
$summaryreport = $report | select Server,"Error Details","Warning Details" | Where {$_."Error Details" -ne "" -or $_."Warning Details" -ne ""}
# Create HTML Report
# Common HTML head and styles
$htmlhead="<html>
<style>
BODY{font-family: Arial; font-size: 8pt;}
H1{font-size: 16px;}
H2{font-size: 14px;}
H3{font-size: 12px;}
TABLE{border: 1px solid black; border-collapse: collapse; font-size: 8pt;}
TH{border: 1px solid black; background: #dddddd; padding: 5px; color: #000000;}
TD{border: 1px solid black; padding: 5px; }
td.pass{background: #7FFF00;}
td.warn{background: #FFE600;}
td.fail{background: #FF0000; color: #ffffff;}
</style>
<body>
<h1 align=""center"">Exchange Server Health Check Report</h1>
<h3 align=""center"">Generated: $reportime</h3>"
if ($summaryreport)
{
$summaryhtml = "<h3>Exchange Server Health Check Summary</h3>
<p>The following errors and warnings were detected.</p>
<p>
<table>
<tr>
<th>Server</th>
<th>Errors</th>
<th>Warnings</th>
</tr>"
foreach ($reportline in $summaryreport)
{
$htmltablerow = "<tr>"
$htmltablerow = $htmltablerow + "<td>$($reportline.server)</td>"
$htmltablerow = $htmltablerow + "<td>$($reportline."Error Details")</td>"
$htmltablerow = $htmltablerow + "<td>$($reportline."Warning Details")</td>"
$summaryhtml = $summaryhtml + $htmltablerow
}
$summaryhtml = $summaryhtml + "</table></p>"
}
else
{
$summaryhtml = "<h3>Exchange Server Health Check Summary</h3>
<p>No Exchange server health alerts or warnings.</p>"
}
if ($report)
{
# Exchange 2007/2010 Report Table Header
$htmltableheader = "<h3>Exchange Server 2007/2010 Health</h3>
<p>
<table>
<tr>
<th>Server</th>
<th>Site</th>
<th>Roles</th>
<th>Version</th>
<th>DNS</th>
<th>Ping</th>
<th>Uptime (hrs)</th>
<th>CA Services</th>
<th>HT Services</th>
<th>MB Services</th>
<th>UM Services</th>
<th>Transport Queue</th>
<th>PF DBs Mounted</th>
<th>MB DBs Mounted</th>
<th>MAPI Test</th>
<th>Mail Flow Test</th>
</tr>"
# Exchange 2007/2010 Report Table
$htmltable = $htmltable + $htmltableheader
foreach ($reportline in $report)
{
$htmltablerow = "<tr>"
$htmltablerow = $htmltablerow + "<td>$($reportline.server)</td>"
$htmltablerow = $htmltablerow + "<td>$($reportline.site)</td>"
$htmltablerow = $htmltablerow + "<td>$($reportline.roles)</td>"
$htmltablerow = $htmltablerow + "<td>$($reportline.version)</td>"
switch ($($reportline.dns))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline.dns)</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline.dns)</td>"}
}
switch ($($reportline.ping))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline.ping)</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline.ping)</td>"}
}
if ($($reportline."uptime (hrs)") -eq "Access Denied")
{
$htmltablerow = $htmltablerow + "<td class=""warn"">Access Denied</td>"
}
else
{
$hours = [int]$($reportline."uptime (hrs)")
if ($hours -le 24)
{
$htmltablerow = $htmltablerow + "<td class=""warn"">$hours</td>"
}
else
{
$htmltablerow = $htmltablerow + "<td class=""pass"">$hours</td>"
}
}
switch ($($reportline."CA Services"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."CA Services")</td>"}
"Warn" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."CA Services")</td>"}
"Access Denied" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."CA Services")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."CA Services")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."CA Services")</td>"}
}
switch ($($reportline."HT Services"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."HT Services")</td>"}
"Warn" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."HT Services")</td>"}
"Access Denied" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."HT Services")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."HT Services")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."HT Services")</td>"}
}
switch ($($reportline."MB Services"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."MB Services")</td>"}
"Warn" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."MB Services")</td>"}
"Access Denied" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."MB Services")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."MB Services")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."MB Services")</td>"}
}
switch ($($reportline."UM Services"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."UM Services")</td>"}
"Warn" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."UM Services")</td>"}
"Access Denied" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."UM Services")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."UM Services")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."UM Services")</td>"}
}
switch ($($reportline."Transport Queue"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."Transport Queue")</td>"}
"Warn" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."Transport Queue")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."Transport Queue")</td>"}
"Unknown" {$htmltablerow = $htmltablerow + "<td class=""warn"">$($reportline."Transport Queue")</td>"}
default {$htmltablerow = $htmltablerow + "<td >$($reportline."Transport Queue")</td>"}
}
switch ($($reportline."PF DBs Mounted"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."PF DBs Mounted")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."PF DBs Mounted")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."PF DBs Mounted")</td>"}
}
switch ($($reportline."MB DBs Mounted"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."MB DBs Mounted")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."MB DBs Mounted")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."MB DBs Mounted")</td>"}
}
switch ($($reportline."MAPI Test"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."MAPI Test")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."MAPI Test")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."MAPI Test")</td>"}
}
switch ($($reportline."Mail Flow Test"))
{
"Pass" {$htmltablerow = $htmltablerow + "<td class=""pass"">$($reportline."Mail Flow Test")</td>"}
"Fail" {$htmltablerow = $htmltablerow + "<td class=""fail"">$($reportline."Mail Flow Test")</td>"}
default {$htmltablerow = $htmltablerow + "<td>$($reportline."Mail Flow Test")</td>"}
}
$htmltablerow = $htmltablerow + "</tr>"
$htmltable = $htmltable + $htmltablerow
}
$htmltable = $htmltable + "</table></p>" + "<p><h3>" + $log + "</h3><p>"
}
$htmltail = "</body>
</html>"
$htmlreport = $htmlhead + $summaryhtml + $htmltable + $htmltail
# Send email message
$Context.SendMail($smtpto, $messageSubject, $NULL, $htmlreport)