Changing the Maximum Message Size in Exchange 2010

This little script will change the maximum message size for an Exchange 2010 server. It’s not  tested and designed for use in very large Exchange organizations, but has been tested and works on single Exchange 2010 server environments such as Windows Small Business Server 2011 Standard.

edited: 19/2/2011. reminded by Brian Desmond that I really should use param($MaxSize). Thanks!

# Change-ExchSize.ps1
# Script to change the size of the maximum send and receive for
# a Windows SBS 2011 Standard installation with Exchange 2010
# Expects: maximum size parameter in MB or prompts
# Created: 19/2/2011
# ModHist: 19/2/2011 (changed to use param(). Thanks Brian

if (! $MaxSize ) {
$MaxSize = Read-Host "What's the max size(in MB) you want for all mailboxes? "
$stMaxSize = "$MaxSize" + "MB"

"Setting Maximum Send and Receive Transport Size to: $stMaxSize"
Set-TransportConfig -MaxSendSize $stMaxSize -MaxReceiveSize $stMaxSize
Get-TransportConfig | ft -maxsendsize,maxreceivesize

"Setting Maximum Send and Receive Connectors to: $stMaxSize"
$ReceiveConnectors = Get-ReceiveConnector
$SendConnectors = Get-SendConnector

ForEach ($Connector in $ReceiveConnectors ) {
Set-ReceiveConnector -Identity $ -MaxMessageSize $stMaxSize

ForEach ($Connector in $SendConnectors ) {
Set-SendConnector -Identity $ -MaxMessageSize $stMaxSize

"The Maximum Receive Connector size has been set to: "
Get-ReceiveConnector | ft Name, MaxMessageSize

"The Maximum Send Connector size has been set to: "
Get-SendConnector | ft Name, MaxMessageSize

One Response to Changing the Maximum Message Size in Exchange 2010

  • Neil says:

    Get-ReceiveConnector | Set-ReceiveConnector -MaxMessageSize $stMaxSize
    Get-SendConnector | Set-SendConnector -MaxMessageSize $stMaxSize