Forum Discussion

ankit shukla's avatar
ankit shukla
Iron Contributor
Aug 08, 2019

The total data received from the remote client exceeded the allowed maximum. The allowed maximum ...

I'm running this command in Exchange Online PowerShell to Check permission of a User on all mailboxes in the Organization (For Auditing Purpose) - 

 

1. Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -User Ankit (Fails )

2. Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -User Ankit | Export-csv (Fails )

3. $Mailboxes = Get-Mailbox -ResultSize Unlimited

 $mailboxes | Get-Mailboxpermission -user Ankit | Export-csv (Fails 

4.  $mailboxes |Get-MailboxPermission -User Ankit ; Start-Sleep -Milliseconds 500| Export-Csv

 

All of them fail with Error - Sending data to a remote command failed with the following error message: The data in the command exceeded the maximum size that is
allowed by the session configuration. The allowed maximum is 500 MB. Change the input, use a different session configuration, or
change the "PSMaximumReceivedObjectSizeMB" and "PSMaximumReceivedDataSizePerCommandMB" properties of the session configuration on
the remote computer. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName : outlook.office365.com

 

Sending data to a remote command failed with the following error message: The total data received from the remote client exceeded
the allowed maximum. The allowed maximum is 524288000. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : JobFailure
+ PSComputerName : outlook.office365.com

 

  • TheFrog's avatar
    TheFrog
    Copper Contributor
    The pb seems to be the size of what you transfer by the network. Well, reduce the size of what is transferred. How? > Filter on your 1st cmdlet (Get-Mailbox). > Try a : Get-Mailbox - Identity OneUser and look at the returned result. It returns a lot of things. However, only the MailboxIdParameter parameter is strictly necessary for the 2nd cmdlet. $Mailboxes = Get-Mailbox -ResultSize unlimited | select-object -property MailboxIdParameter should be significantly smaller. > Then go to the 2nd cmdlet Get-Mailboxpermission to keep only the properties that interest you if necessary before exporting to a .csv. Regards.
  • Those one-liners are convenient, but they don't really work in scenarios where you have thousands and thousands of users, as you've already noted. Get the list of user mailboxes, store it in a variable, then do a loop over each. If that fails as well, minimize the amount of data transferred by fetching just the bare minimum of properties you need, instead of the 200+ that Get-Mailbox returns. This can be done by using the method detailed here: https://techcommunity.microsoft.com/t5/Exchange-Team-Blog/Running-PowerShell-cmdlets-for-large-numbers-of-users-in-Office/ba-p/604280

Resources