Solved

Send-MailMessage

Posted on 2013-06-19
3
606 Views
Last Modified: 2013-06-24
I have a question relating to sending SMTP email from powershell.  I have written a short command that pulls information out of o365 and emails it to a group of people.  The script works when I run it out of the ISE, but when I try and automate it as a task it fails in powershell.exe.  The command comes back with cannot connect to smtp server.
Is there generally an extra switch that needs to be added to a send-mailmessage command to make it connect to a SMTP server that isn't needed when sending through ISE?

Abbreviation of command I am using:
Send-MailMessage -from <name> -to <names> -Subject "Daily License Count" -Body (function | Out-String) -SmtpServer <server>
0
Comment
Question by:mjkerrig
  • 2
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39259316
make sure that the account used to run the script in the scheduled task have permission to send through your smtp server.
0
 

Accepted Solution

by:
mjkerrig earned 0 total points
ID: 39259627
I just found an article that put me on the right track.  Turns out that it is McAfee causing the issue.  It doesn't block the server calls out of ISE, but does block the requests out of standard powershell.
0
 

Author Closing Comment

by:mjkerrig
ID: 39270683
Found an article that put me on checking the firewall for blocking powershell.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Hi all.   The other day I had to change the passwords for a bunch of users on the fly. Because they were so many, I decided to do it in an automated way and I would like to share it with you all.   If you are not doing it directly in a Domain Co…
This article will help you understand what HashTables are and how to use them in PowerShell.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now