Solved

Send-MailMessage

Posted on 2013-06-19
3
627 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

695 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