Tip: An Easy Way to send Windows PowerShell Output as E-Mail

Follow Our Daily Tips

Twitter | Blog | RSS | Facebook

It is a common request to be able to send information from a script to an e-mail recipient. In the past, this generally required writing a complicated function and hoping that all of the details were put together correctly to enable this functionality to work properly. (It was easier to do before spammers caused security concerns about sending e-mail from scripts. E-mail viruses have added additional layers of authentication and made the process much more confusing.)

In Windows PowerShell 2.0, the Send-MailMessage cmdlet can be used to simplify the task of sending e-mail from a script. In some cases, this cmdlet works without any additional con¬figuration on your network. At other times, you need to grant the user account that is being used to run the script permission to send e-mail from the script.

From the Microsoft Press book Windows PowerShell 2.0 Best Practices by Ed Wilson with the Windows PowerShell Teams at Microsoft.

Looking for More Tips?

For more tips on using Microsoft products and technologies, visit the TechNet Magazine Tips library.