How to format an object into a nice HTML table?

前端 未结 2 859
死守一世寂寞
死守一世寂寞 2021-01-26 02:15

I have 2 scripts

script1 has the following:

$exportObject = New-Object System.Collections.ArrayList
$exportObject | Select-Object

in sc

2条回答
  •  猫巷女王i
    2021-01-26 02:26

    Not sure what's going wrong for you. This works for me:

    $Body = Get-ChildItem C:\Windows\ -File | 
        Select-Object -Property Name, Length, LastWriteTime -First 10 |
        ConvertTo-Html -As Table -Head '' |
        Out-String
    
    Send-MailMessage -SmtpServer $SmtpServer -UseSsl -Subject $Subject -To $To -From $From -Body $Body -BodyAsHtml
    

提交回复
热议问题