Wednesday, April 25, 2012

Receive Connector Rejected an Incoming Connection

On an Exchange server, you might get the error below if you have a server or an application creating more than 20 concurrent connections to a custom Receive Connector:

Log Name:      Application
Source:        MSExchangeTransport
Date:          04/20/2012 16:15:52
Event ID:      1021
Task Category: SmtpReceive
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      HTCAS1.letsexchange.com
Description:
Receive connector "Unauthenticated SMTP" rejected an incoming connection from IP address xxx.xxx.xxx.xxx. The maximum number of connections per source (20) for this connector has been reached by this source IP address.

This means that you have a large number of connections coming from the same IP address. To prevent connections from being rejected, if this volume of connections is normal, you have to change the maximum number of connections per source.

To check the current limit (20 by default), run the following cmdlet and look for MaxInboundConnectionPerSource:
Get-ReceiveConnector <server_name>\<name> | Select *MaxInbound*

To increase the limit, you have to use the Exchange Management Shell:
Set-ReceiveConnector <server_name>\<name> -MaxInboundConnectionPerSource 500 -MaxInboundConnectionPercentagePerSource 100

If you have the same receive connector in multiple servers, you can run the following cmdlet instead to update all at the same time and in one go:
Get-ReceiveConnector *\<name> | Set-ReceiveConnector -MaxInboundConnectionPerSource 500 -MaxInboundConnectionPercentagePerSource 100

Hope this helps!

Sunday, April 22, 2012

Email Latency

If you want to find out the overall latency for e-mails flowing in your Exchange 2007 organization, you can use the MSGAnalyzer tool from Microsoft or you have to check when an e-mail first reached your servers, check when it was delivered to the recipient’s mailbox and then calculate the time difference.

The good news is that with Exchange 2010 this is much, much easier as this information is saved in the Message Tracking Logs. When a HUB server delivers a message (through the Store Driver) it generates a DELIVER event which contains the TimeStamp of when the message was delivered (as with Exchange 2007) but now it also includes the MessageLatency which is the difference between the original arrival time of the message and this timestamp.

So, if you want to check the latency for all the e-mails arriving in your organization, simply use the a cmdlet similar to the following one:

Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start "03/26/2012" -EventID DELIVER | FT MessageLatency

Which will give you a TimeSpan value like “00:00:03.8130000” which means the e-mail took almost 4 seconds to be delivered.

If you are just interested in a particular day and also want to know which HUB server delivered it each message:
Get-TransportServer | Get-MessageTrackingLog -ResultSize Unlimited -Start "03/26/2012" -End "03/27/2012" -EventID DELIVER | Select TimeStamp, ClientHostname, @{Label="LatencyMil"; Expression={$($_.MessageLatency).TotalMilliseconds}} | Export-Csv Latency_20120326.csv -NoTypeInformation

Note that this time we are printing the TotalMilliseconds it took to deliver each message which makes it easier to calculate the average for the day in Excel.

Thursday, April 19, 2012

Mailbox Item Count

Ever wondered how many items all the mailboxes in your Exchange environment currently have? Getting a weekly count of these, together with the total mailbox size, might be useful so you get a trend on your environment’s growth.
For a single mailbox, you can simply use the following cmdlet:
Get-MailboxStatistics user1 | Select ItemCount
Or if you want to get a count per database for example:
Get-MailboxStatistics –Database MDB1 | ForEach {$totalItems += $_.ItemCount}
$totalItems
If you want for every single mailbox in your environment, you can use the following cmdlet:
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select ItemCount | ForEach {$totalItems += $_.ItemCount}

Thursday, April 5, 2012

2012 PowerShell Scripting Games

I should have posted this a long time ago, but better late than never!...   :)
The good news is that you can still participate as the deadline for the first event is only next Sunday/Monday.
2012 Windows PowerShell Scripting Games: All Links on One Page

2012 Scripting Games