Powershell: Increase the max size limit for ActiveSync Properties/Metadata in you Web.Config

Scenario:  You need to increase the ActiveSync default message size limit from 10MB to a larger value.  By default the RequestFilteringLimit set in IIS is 30,000,000 bytes (approx. 28MB) so we will operate within the limitations of that setting, meaning you cannot go higher than 28MB unless you set that property to a higher value.  So lets be safe and set that value to 15MB on all multirole exchange 2013 servers.  We need to edit the web.config files in the following directories:
Client Access: 

%ExchangeInstallPath%FrontEndHttpProxySyncweb.config – maxRequestLength=”10240″ kilobytes


%ExchangeInstallPath%ClientAccessSyncweb.config – maxRequestLength=”10240″ kilobytes

%ExchangeInstallPath%ClientAccessSyncweb.config  – <add key=”MaxDocumentDataSize” value=”10240000″>  bytes
Script:  IISReset is not needed!

$servers = (Get-ExchangeServer).name
$MRL = "15360"  #15MB in KB
$MDDS = "15728640" #15MB in Bytes

$Servers | %{
    $webConfig = "\$_c$Program FilesMicrosoftExchange ServerV15FrontEndHttpProxysyncweb.config" 
    $doc = new-object System.Xml.XmlDocument 
    $doc.get_DocumentElement()."system.web".httpruntime.maxrequestlength = $MRL 
    #Save Document

    $webConfig = "\$_c$Program FilesMicrosoftExchange ServerV15ClientAccessSyncweb.config" 
    $doc = new-object System.Xml.XmlDocument 
    $doc.get_DocumentElement()."system.web".httpruntime.maxrequestlength = $MRL 
    $key = "MaxDocumentDataSize"
    $node = $doc.SelectSingleNode('configuration/appSettings/add[@key="' + $key + '"]') 
    $node.Attributes['value'].Value = $MDDS 
    #Save Document




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: