Exchange server email reports

Permabanned
Joined
28 Dec 2009
Posts
13,052
Location
london
I am trying to set up some powershell scripts to automatically send the reports to the IT mailbox.

The two reports:

http://gallery.technet.microsoft.com/office/Exchange-DAG-Replication-d8e99705
http://www.stevieg.org/2011/06/exchange-environment-report/

The second script has a built in mail and scheduler options but when i try to make it send an email i get smtp authentication error.

Code:
.\Get-ExchangeEnvironmentReport  -HTMLReport c:\report.html -SendMail:$true -MailFrom:[email protected] -MailTo:[email protected] -MailServer:smtp.example.com

This is the error message. Obviously i updated the command with the relevant site specific details.

Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server respons
e was: 5.7.1 Client was not authenticated
At C:\PowerShellScripts\Get-ExchangeEnvironmentReport.ps1:996 char:18
+ Send-MailMessage <<<< -Attachments $HTMLReport -To $MailTo -From $MailFrom -Subject "Exchange Environment Report
" -BodyAsHtml $Output -SmtpServer $MailServer
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpExcept
ion
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage

Now in previous version of exchange I would right click on the smtp protocol and have to add other servers ip address to the allow list in order for it to use smtp. But I am trying to send an email from the exchange server itself and i would have thought the exchange server would be added automatically to smtp allow list?

I did find this guide for adding a new relay connector but that is more relevant for relaying from different servers.

http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010/

Any idea how i can get these powershell scripts to send email?
 
Last edited:
There is only one user with exchange management roles and that's "admin" this the account that i am logged in to exchange server with and account that has opened management shell.

I tried manually sending a message direct from the management shell using powershell command and that had the same result, i did this to rule out script problem.

Definitely a problem with allowing smtp not allowing anonymous relay or something to that effect.

Ive tried creating a send connector for the exchange server as remote address with the anonymous permission allowed and restarted the hub transport service, but still same result.
 
Last edited:
Don't you need an anonymous relay receive connector? Watch out and make sure you lock it down to only allow connection from certain allowed ip ranges.
 
Yes i am aware of that possible security issue. I tried to lock it down to exchange ip address and tried various settings on the connector but couldn't get it too work. I've given up for today as other things to do, ill just do it manually for now.
 
I wouldn't mess with the default receive connector. Add a new one that allows anonymous connections, and only give access to certain IP addresses.
 
Yes i am aware of that possible security issue. I tried to lock it down to exchange ip address and tried various settings on the connector but couldn't get it too work. I've given up for today as other things to do, ill just do it manually for now.

Sure you just talked about send connectors instead of receive connectors in your posts. I agree with the post below as well, configure a new RC is a good idea. I add that adding a new ip for it is also a good idea.
 
http://exchangeserverpro.com/how-to-configure-a-relay-connector-for-exchange-server-2010/

In this guide which i posted in op. It shows how to make a receive connector. I was not messing with the default or client connectors. I was creating a new one I tried different options on the connector. Anonymous with tls auth. Then exchange servers and external IP security option. Neither of these options fixed the problem.

Maybe its the ip address, maybe i should use localhost in the remote network option? Its the exchange server itself that i am trying to send the mail from, so it seems strange to me that the exchange server itself is not on the smtp allow list as there is the option on the default receive connector for exchange servers on the permissions tab and that is enabled.

Maybe its a powershell issue? Maybe its a result of mixed environment.
 
Sure I get you, well you can try testing it out with Telnet on port 25 to the IP address, see if you can get it to accept email. Alternatively, try setting the $MailServer variable to be the same as your primary MX record IP address/host name.

If that accepts mail from the net, then it should accept your connection too, unless it's locked down somehow.
 
Back
Top Bottom