Hi,
I have some objects stored in a variable and would like to use the select-object, do a format table and send them in an email.
I am managing to do this by converting them to a string, however the formatting of the string/email is a one liner.
How can I separate them to a different line? I want them to show , as when you do Format-Table for example.
This is what I am doing (In soon expiring there are multiple thing):
$body = $soonexpiring | Select-Object -Property samaccountname, @{label=‘Person Responsible’;expression={$_.manager -replace ‘^CN=|,.*$’}} | Format-Table | Out-String
send-MailMessage -SmtpServer $smtp -To $to -From $from -Subject $subject -Body $body -BodyAsHtml -Priority high
How can this be done?
Thanks in advance! ![]()