Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Powershell to send email with attachment only if file is full

$
0
0
Hi All,Hope All is Well.I am new to powershell. I am trying to attach a txt file using the following in a ps file and it works well.Send-MailMessage -To <> -From <> -Subject "System Events" -Attachments "c:\scripts\sysevents.txt" -SmtpServer <>I need help in writing my logic using powershell where if the sysevents.txt is empty then it should not send email. It should only send email if the txt file has data in it.Thanks Much for your inputs.

Viewing all articles
Browse latest Browse all 467

Trending Articles