# Report Help for Invoke-Command

**URL:** <https://forums.powershell.org/t/report-help-for-invoke-command/17011>\
**Category:** PowerShell Help\
**Created:** [July 7, 2021, 7:19pm UTC](https://forums.powershell.org/t/report-help-for-invoke-command/17011 "2021-07-07T19:19:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![freebird317](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@freebird317](https://forums.powershell.org/u/freebird317)\
**Post date:** [July 7, 2021, 7:19pm UTC](https://forums.powershell.org/t/report-help-for-invoke-command/17011/1 "2021-07-07T19:19:54Z")

</div>

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.

```auto
$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

```

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 7, 2021, 9:05pm UTC](https://forums.powershell.org/t/report-help-for-invoke-command/17011/2 "2021-07-07T21:05:14Z")

</div>

freebird317,  
Welcome to the forum.

Please when you post code, error messages, console output or sample data format it as code using the “_preformatted text_” button ( **\</\>** ).

Thanks in advance.

What you asked for is not achievable with a simple pure PowerShell way. But you’re not the first to ask for a reqwuirement like this. A great source of help is the ebook “Creating HTML Reports in PowerShell” by Don Jones. It is available cheap or free on [leanpub.com](http://leanpub.com)

> **[Creating HTML Reports in Windows PowerShell](https://leanpub.com/creatinghtmlreportsinwindowspowershell)**
>
> Learn to create beautifully formatted, multi-section HTML reports in PowerShell!

Basically you would need to add some CSS styles to your resulting HTML file header and insert some CSS/HTML tags to the proper places in your generated HTML output.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:23pm UTC](https://forums.powershell.org/t/report-help-for-invoke-command/17011/3 "2024-05-16T20:23:58Z")

</div>

Closed on May 16, 2024, 8:23pm UTC


