Sending reports by e-mail

After creating a report, you might want to send it to your boss or to yourself. The PowerShell Send-MailMessage cmdlet can send e-mail messages using an SMTP server. The syntax of this cmdlet is as follows:

Send-MailMessage [-To] <String[]> [-Subject] <String> [[-Body] <String>] [[-SmtpServer] <String>] [-Attachments <String[]>] [-Bcc <String[]>] [-BodyAsHtml] [-Cc <String[]>] [-Credential <PSCredential>] [-DeliveryNotificationOption <DeliveryNotificationOptions>] [-Encoding <Encoding>] [-Port <Int32>] [-Priority <MailPriority>] [-UseSsl] -From <String> [<CommonParameters>]

The –From, -To, and –Subject parameters are required to send a report by e-mail. You can use the PowerShell $PSEmailServer preference variable for ...

Get Learning PowerCLI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.