locked
Email PSObject results as body and keep formatting RRS feed

  • Question

  • Hi all,

    I would like to send the results of a PSObject in the body of an email formatted as a table, headings and all.

    The PSObject is generated using the code below in a ForEach loop. From the console, if I type $report | ft, I see the output nicely formatted. I want  to maintain this nicely formatted table and send it in an email.

    Any help appreciated.

    $ReportObj = New-Object PSObject
    $ReportObj | Add-Member NoteProperty -Name "DB Name" -Value $DB.Name
    $ReportObj | Add-Member NoteProperty -Name "DB Size GB" -Value $DBSize.DBSizeGB
    $ReportObj | Add-Member NoteProperty -Name "Log Size GB" -Value $LogPathSize
    $ReportObj | Add-Member NoteProperty -Name "Log Count" -Value $LogPathCount
    $ReportObj | Add-Member NoteProperty -Name "Days Since Backup" -Value $DateDiff.Days
    $Report += $ReportObj

     


    Pedro

    Wednesday, February 5, 2020 4:06 PM

All replies