Ok, this may have been answered, but I\'m new and trying to learn, so I guess I\'m not \"getting\" it. I have a variable that contains a table of information (I got it from
For someone looking for a simple table,here is what i have found
add below variable first
$Header = @"
"@
You can add like below then
Get-PSDrive | ConvertTo-Html -Property Name,Used,Provider,Root,
CurrentLocation
-Head $Header | Out-File -FilePath PSDrives.html
While reading the file,ensure you use -raw
as a parameter like bellow
Get-ChildItem Cert:\LocalMachine\My | Where-Object {$_.NotAfter -ge (get-date -DisplayHint Date) } |ConvertTo-Html -Property Issuer,Thumbprint,Notafter -Head $Header | Out-File C:\Iris\Cert.html
$body=Get-Content -Path C:\Iris\cert.html -Raw
then while sending mail, you can do
send-emailmessage -body $body -bodyashtml #other values
References:
https://4sysops.com/archives/building-html-reports-in-powershell-with-convertto-html/