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.
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.
- The script checks for running in elevated administrator 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 or Exchange 2016.
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
If you want to configure EWS limits for all servers, resetting IIS, you could use:
.\Configure-ClientSizeLimits.ps1 -AllServers -EWS 10240 -Reset
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.