Код:

Get-WinEvent -FilterHashtable @{LogName="System";Id=20271,20272;StartTime=[datetime]::Today} | Format-List * | out-file C:\log.txt
send-mailmessage -from "User01 <user01@example.com>" -to "User02 <user02@example.com>" -subject "Sending the Attachment" -body "Forgot to send the attachment. Sending now." -Attachment "C:\log.txt" -smtpServer smtp.fabrikam.com