Client Message Size Limits

powershell

Last Update: Version 1.4, July 19th, 2019

Exchange Server 2013 and Exchange Server 2016 enforces certain message size limits when it comes to client messages. These limits are in-place so clients can’t generate excessive load on your Exchange environment. These limits are determined for various access methods in multiple web.config files on Exchange Client Access Servers as well as Mailbox Servers.

Sometimes you may have good reasons to increase those limits. For example, when migrating to Office 365 using a product like MigrationWiz, you may want to increase the limit for Exchange Web Service (EWS) requests to allow for migration of larger items. Another example is when you want to allow for bigger attachments in Outlook WebApp (OWA). On TechNet, there’s an article on how to reconfigure these limits. However, the process consists of editing multiple web.config files, replacing multiple values in the same file, and following this process on each Exchange 2013/2016 server in your environment. This is not only labor intensive and prone to error, but becomes tedious when you consider that each Cumulative Update will overwrite your web.config files.

But do not despair. To execute these changes for OWA and EWS, I have created a PowerShell script which will perform these tasks for you.

Requirements
Using the script requires Exchange 2013. You need to provide the server name (default is local server) or AllServers to apply to all Exchange 2013/2016 servers in your environment. The script will modify the web.config remotely using the system share (e.g. C$), using the location of the Exchange installation, and uses IISRESET tool to restart IIS. It will create a backup of the web.config before modifying it.

Notes:

  1. The script checks for running in elevated administrator mode when running against the local machine.
  2. Current version of the script requires Exchange Management Shell, to run Exchange cmdlets for checking installed roles a.o., as the web.config files which require editing depend on the installed roles.
  3. For OWA, add ~33% to the value you want to specify to compensate for encoding overhead.
  4. When connected to an Exchange server, the script processes the server hosting the EMS session last to prevent abortion caused by IIS reset.
  5. Script currently runs against Exchange 2013 or Exchange 2016.

Usage
The script Configure-ClientSizeLimits.ps1 uses the following syntax:

.\Configure-ClientSizeLimits.ps1 [-Server |-AllServers] [-OWA <size>] [-EWS <size>] [-EAS <size>] [-Reset] [-NoBackup] 

A quick walk-through on the parameters and switches:

  • Server specifies the server to configure. When omitted, it will configure the local server. This parameter is mutually exclusive with AllServers.
  • AllServers switch specifies to configure all Exchange 2013 servers. This switch is mutually exclusive with Server.
  • OWA configures the message size limit for Outlook Web Access. Value is in bytes.
  • EWS configures the message size limit for Exchange Web Services. Value is in bytes.
  • EAS configures the message size limit for Exchange ActiveSync. Value is in bytes.
  • NoBackup tells the script not to make backup copies of modified web.config files.
  • Reset switch specifies to perform an IISRESET against servers after reconfiguration of client-specific message size limits.

So, suppose you want to configure OWA, EWS and EAS client message size limits on the local Exchange server, you can use:

.\Configure-ClientSizeLimits.ps1 -OWA 15MB -EWS 15MB EAS 15MB
cs

If you want to configure EWS limits for all servers, resetting IIS, you could use:

.\Configure-ClientSizeLimits.ps1 -AllServers -EWS 10240 -Reset

Download
You can download the script from the TechNet Gallery here or GitHub.

Feedback
Feedback is welcomed through the comments. If you got scripting suggestions or questions, do not hesitate using the contact form.

Revision
See TechNet Gallery page.

24 thoughts on “Client Message Size Limits

  1. Pingback: Exchangepedia | Set message size limits in Exchange 2010/2013 and Exchange 2007

  2. Pingback: Raise your Exchange Server EWS limits prior to starting your MigrationWiz project – Microsoft Exchange & Office 365

  3. Pingback: Weekly IT Newsletter – June 22-26, 2015 | Just a Lync Guy

  4. Hi, I’ve found your post very useful. At this moment I’m having something that could be fixed with your script. I’m having issues between Exchange 2010 and a Mac computer trying to send messages with attachment bigger than 9 MB and we receive an error each time we need to send a message. I tried to modify the web.config files manually but then the Mac computer wasn’t able to connect to the Exchange I had to revert the change.
    Can I use your script on an Exchange 2010 server?
    Regards!

    Like

  5. Pingback: 配ē½®å®¢ęˆ·ē«ÆęŒ‡å®šę¶ˆęÆ大小限制 - Exchangeäø­ę–‡ē«™

  6. Hi Michel,

    This is a great script; thank you.

    Would there be any chance you could include the ability to update the ActiveSync settings at the same time as OWA and EWS?

    This would be extremely helpful.

    Like

  7. Found your script and figured this is a nice alternative to manually changing the thresholds like in the past. I am Running Exchange 2016 and just applied CU10, everything was working fine, then I ran your script, did an IISRESET and OWA/EAC access broke. Tested on a second DAG server and same result. Reverted to old web.config files and all is working again. Not sure if something has changes in the latest CU, but wanted to let you know.

    Like

  8. (Forgive me if I already submitted but I hit an error with wp so I’m not sure if it installs)
    If i use a whatif it only applies to the backup portion of the script) is it possible to make it so whatif will effect the web.config modifications. (I have my own backup method so I was able to restore original settings)

    Like

      • Thanks! I”ll run it in my test environment. I see some issues with CU10 according to the comments, I’m still on CU7. Is the error with the changes due to the script or is it part of the CU that causes the error?

        Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.