Email with .log file...

Topics: Archive - Deployment Scripts
Jan 12, 2015 at 8:00 PM
I have been using the APP Deployment Toolkit for all of my applications and I love it but there is one feature missing or that I don't know how to code that is stopping me from converting all of my .VBS scripts to PS.

How can I after every install, repair and uninstall send an email to a email address with the .LOG attachment? Any answer would be greatly appreciated.

If you need more information please let me know.


Mar 18, 2015 at 11:03 PM
Edited Mar 18, 2015 at 11:05 PM
I added this line to the end of the script and it works great for me, (update for your emails and servers of course).

Send-MailMessage -From "Sender Name" -To "Recipient Name" -Subject "Subject Line of Email Here" -Body $exceptionMessage -dno OnFailure -SmtpServer

If there's an error in the script, it sends the $exceptionMessage in the body of the email, but you could also change it to $logFile (I believe it's called) if you wanted to put the entire log in the body of the email.
Mar 18, 2015 at 11:13 PM
Send-MailMessage is not a toolkit function. It must be a private function you use. You should post it to the Toolkit Extensions forumif you meant to share it with the user above.
Mar 19, 2015 at 6:25 PM
Edited Mar 19, 2015 at 6:26 PM
Oh ok, sorry about that. I believe it's just a basic PowerShell function though, Send-MailMessage, nothing private that I set up. I added it to the end of Deploy-Application.ps1