Solved

Send-MailMessage

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
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 …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

776 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