I need some help outputting a a hash table to the body of an email message.
$computer = "adwte998"
$err = "This is the error"
$td = Get-Date
$table = @{
Workstation = $computer
Error = $err
Time = $td
}
send-mailmessage -to "email@email.com" -from "Automated Reboot<no-reply@email.com>" -subject "E-Mail HashTable Test" -body ($table | Out-String) -smtpserver smtpserver.email.com
The Message body looks like it should if i just returned the $table
I would ideally like to convert the table to a format that looks like a CSV with the proper columns and headers but I don't want to email it as an attachment.
Does anyone know how i can go about doing this? I would even considering converting it to HTML so it looks nice in the email.
Using V3:
for HTML: