Solved

Send-MailMessage

Posted on 2013-06-19
3
608 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Synchronize a new Active Directory domain with an existing Office 365 tenant
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

862 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

22 Experts available now in Live!

Get 1:1 Help Now