I am running the below and it sends me an email that is table formated with columes Name and PSComputername. What I am trying to figure out is how can I make the table show red when the domain profile is not equal to DomainAuthenticated.
$time=[datetime]::Today.AddDays(-30)
$Servers = Get-ADComputer -Filter {LastLogonDate -gt $time -And OperatingSystem -Like '*server*' } -SearchBase "OU=Domain,DC=com"
$Results = ForEach ($Server IN $Servers){
Invoke-Command -computername $Server.Name -ScriptBlock {Get-NetConnectionProfile} | Select Name,PSComputername
}
$Header = @"
<style>
TABLE {border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}
TH {border-width: 1px;padding: 3px;border-style: solid;border-color: black;}
TD {border-width: 1px;padding: 3px;border-style: solid;border-color: black;}
</style>
"@
$HTML = $Results | ConvertTo-Html -Head $Header -PreContent "<h3>Firewall Profile Status</h3>" -PostContent "<p><br/><h6>Run on: $(Get-Date)</p>" | Out-String
Send-MailMessage -From 'Status@domain.com' -To 'user@domain.com -Subject 'Firewall Profile Status' -SMTPServer "mail.domain.com" -Body $html -BodyAsHtml