Friday, November 27, 2015

The Total Data Received From the Remote Client Exceeded Allowed Maximum

Working with a large number of mailboxes is usually about the same a working with a small number of mailboxes, except that you need to include -ResultSize Unlimited in your Get-* cmdlets. However, I recently ran into the following error when getting a large list of mailboxes (approx 38K) with Get-Mailbox and piping them to Set-Mailbox:
Sending data to a remote command failed with the following error message: The total data received from the remote client exceeded allowed maximum. Allowed maximum is 524288000.
In the end this seemed to be a limitation of piping from Get-Mailbox to Set-Mailbox. For example, this would generate the error:
Get-Mailbox -ResultSize Unlimited | Set-Mailbox -SingleItemRecoveryEnabled $true
One option to work around this is to chunk up the work and do it by database instead:
Get-Mailbox -Database XXX -ResultSize Unlimited | Set-Mailbox -SingleItemRecoveryEnabled $true
However, my preferred workaround was this:
$mbx=Get-Mailbox -ResultSize Unlimited
foreach($m in $mbx) {Set-Mailbox $m -SingleItemRecoveryEnabled $true}
Using a foreach loop instead of piping seems to avoid the error when dealing with large data sets. The powershell.exe process for this task consumed about 2.5GB of memory.


  1. Neat and efficient workaround to the "Allowed maximum is 524288000" error. Thanks.

  2. Neat and efficient workaround to the "Allowed maximum is 524288000" error. Thanks.

  3. In trying to delete an email from a particular sender to all mailboxes in Exch2010, I got the allowed max error. Attempted your preferred solution but got error on char 53, the second $mbx:

    $mbx=Get-Mailbox -ResultSize Unlimited foreach($m in $mbx) {Set-Mailbox $m -SingleItemRecoveryEnabled $true} | Search-Mailbox -SearchQuery "" -DeleteContent

    Any recommendations?

    1. Are you doing that as a one liner? It might not have been clear in the example above, but it should be two lines with the foreach starting a second command.

      Also, it looks like you are piping the output of the set-mailbox command to the search-mailbox command. I'm guessing that output doesn't mean anything to the search-mailbox cmdlet. If you want to enable single item recovery also, I'd run it as three lines.

      Line 1 - put mailboxes in $mbx.
      Line 2 - do the foreach loop to set single item recovery
      Lin 3 - another foreach loop to do the search mailbox

      With the caveat that all of that was off the top of my head.