July 2017
Intermediate to advanced
648 pages
31h 9m
English
You may want to write a script that generates a report to a text or CSV file and then email that data to an administrator mailbox. The -Attachment parameter can be used with the Send-MailMessage cmdlet to do this. For example, let's say you've generated a CSV report file for the top 10 largest mailboxes in your environment and it needs to be emailed to your staff. The following command syntax could be used in this scenario:
Send-MailMessage -To support@testlabs.se `
-From powershell@testlabs.se `
-Subject "Mailbox Report for $((Get-Date).ToShortDateString())" `
-Body "Please review the attached mailbox report." `
-Attachments c:\report.csv `
-SmtpServer tlex01.testlabs.se
Notice that all we need to do here ...
Read now
Unlock full access