Forum Discussion
kdvbhuvankumar
May 12, 2020Copper Contributor
How to send email
Hi All, I am new to PS and i need a email message where it sends me by identifying recent file names with date and time in particular folder on the server below is the simple commands i set in t...
gastone
Jun 29, 2020Brass Contributor
You cannot send an object as mail body, you need to convert to string [[-Body] <string>]
$emailObject = Get-ChildItem -path D:\TFTP-Root | Where-Object {$_.LastWriteTime -gt (Get-Date).AddDays(-1)}
$emailcsvtxt= $emailObject |select Mode ,LastWriteTime ,Length ,Name|ConvertTo-Csv