Try this:
Add-PSSnapin Quest.ActiveRoles.ADManagement -ea SilentlyContinue
$body = New-Object System.Text.StringBuilder
$servers = @(Get-QADComputer -ManagedBy ccit | ForEach-Object { $_.name } | Sort-Object)
foreach ($server in $servers)
{
$pingStatus = Get-WmiObject Win32_PingStatus -Filter "Address = '$server'" | Select-Object StatusCode
if ($pingStatus.StatusCode -eq 0)
{
$body.Append("< font color=`"#00FF00`" >$server is online and answering pings.< /font >< br/ >") | Out-Null
}
else
{
$body.Append("< font color=`"#FF0000`" >$server IS OFFLINE AND NEEDS TO BE CHECKED IMMEDIATELY.< /font >< br/ >") | Out-Null
}
}
$mail = New-Object System.Net.Mail.MailMessage("ServerAdmin@test.com", "ndalmolin@test.com", "Server Disk Report", $body.ToString())
$mail.IsBodyHTML = $true
$smtp = New-Object System.Net.Mail.SmtpClient("cas-hub01.test.com")
$smtp.Send($mail)