Last Update: Version 1.11, November 4th, 2015
Exchange 2013 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 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.
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 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.
- The script checks for running in elevated mode when running against the local machine.
- 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.
- For OWA, add ~33% to the value you want to specify to compensate for encoding overhead.
- When connected to an Exchange server, the script processes the server hosting the EMS session last to prevent abortion caused by IIS reset.
- Script currently runs against Exchange 2013.
The script Configure-ClientSizeLimits.ps1 uses the following syntax:
.\Configure-ClientSizeLimits.ps1 [-Server |-AllServers] [-OWA ] [-EWS ] [-Reset]
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 OWA. Value is in 1KB units.
- EWS configures the message size limit for EWS. Value is in 1KB units.
- Reset switch specifies to perform an IISRESET against servers after reconfiguration of client-specific message size limits.
So, suppose you want to configure an OWA message size limit for you can use:
.\Configure-ClientSizeLimits.ps1 -Server EX01 -OWA 100 -EWS 10240 -Reset
If you want to configure EWS limits for all servers without resetting IIS, you could use:
.\Configure-ClientSizeLimits.ps1 -AllServers -EWS 10240
You can download the script from the TechNet Gallery here.
Feedback is welcomed through the comments. If you got scripting suggestions or questions, do not hesitate using the contact form.
See TechNet Gallery page.
Compatibility with Exchange 2010 and removal of dependency on Exchange Management Shell.