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

%3CLINGO-SUB%20id%3D%22lingo-sub-794764%22%20slang%3D%22en-US%22%3EThe%20total%20data%20received%20from%20the%20remote%20client%20exceeded%20the%20allowed%20maximum.%20The%20allowed%20maximum%20...%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-794764%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20running%20this%20command%20in%20Exchange%20Online%20PowerShell%20to%20Check%20permission%20of%20a%20User%20on%20all%20mailboxes%20in%20the%20Organization%20(For%20Auditing%20Purpose)%20-%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1.%20Get-Mailbox%20-ResultSize%20Unlimited%20%7C%20Get-MailboxPermission%20-User%20Ankit%20(Fails%20)%3C%2FP%3E%3CP%3E2.%20Get-Mailbox%20-ResultSize%20Unlimited%20%7C%20Get-MailboxPermission%20-User%20Ankit%20%7C%20Export-csv%20(Fails%20)%3C%2FP%3E%3CP%3E3.%20%24Mailboxes%20%3D%20Get-Mailbox%20-ResultSize%20Unlimited%3C%2FP%3E%3CP%3E%26nbsp%3B%24mailboxes%20%7C%20Get-Mailboxpermission%20-user%20Ankit%20%7C%20Export-csv%20(Fails%26nbsp%3B%3C%2FP%3E%3CP%3E4.%26nbsp%3B%20%24mailboxes%20%7CGet-MailboxPermission%20-User%20Ankit%20%3B%20Start-Sleep%20-Milliseconds%20500%7C%20Export-Csv%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAll%20of%20them%20fail%20with%20Error%20-%26nbsp%3B%3CSTRONG%3ESending%20data%20to%20a%20remote%20command%20failed%20with%20the%20following%20error%20message%3A%20The%20data%20in%20the%20command%20exceeded%20the%20maximum%20size%20that%20is%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Eallowed%20by%20the%20session%20configuration.%20The%20allowed%20maximum%20is%20500%20MB.%20Change%20the%20input%2C%20use%20a%20different%20session%20configuration%2C%20or%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Echange%20the%20%22PSMaximumReceivedObjectSizeMB%22%20and%20%22PSMaximumReceivedDataSizePerCommandMB%22%20properties%20of%20the%20session%20configuration%20on%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Ethe%20remote%20computer.%20For%20more%20information%2C%20see%20the%20about_Remote_Troubleshooting%20Help%20topic.%2B%20CategoryInfo%20%3A%20OperationStopped%3A%20(outlook.office365.com%3AString)%20%5B%5D%2C%20PSRemotingTransportException%2B%20FullyQualifiedErrorId%20%3A%20JobFailure%2B%20PSComputerName%20%3A%20outlook.office365.com%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3ESending%20data%20to%20a%20remote%20command%20failed%20with%20the%20following%20error%20message%3A%20The%20total%20data%20received%20from%20the%20remote%20client%20exceeded%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3Ethe%20allowed%20maximum.%20The%20allowed%20maximum%20is%20524288000.%20For%20more%20information%2C%20see%20the%20about_Remote_Troubleshooting%20Help%20topic.%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20CategoryInfo%20%3A%20OperationStopped%3A%20(outlook.office365.com%3AString)%20%5B%5D%2C%20PSRemotingTransportException%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20FullyQualifiedErrorId%20%3A%20JobFailure%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20PSComputerName%20%3A%20outlook.office365.com%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-794764%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-794965%22%20slang%3D%22fr-FR%22%3ERe%3A%20The%20total%20data%20received%20from%20the%20remote%20customer%20exceeded%20the%20allowed%20maximum.%20The%20maximum%20allowed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-794965%22%20slang%3D%22fr-FR%22%3EThe%20pb%20seems%20to%20be%20the%20size%20of%20what%20you%20transfer%20by%20the%20network.%20Well%2C%20reduce%20the%20size%20of%20what%20is%20transferred.%20How%3F%20Filter%20on%20your%201st%20cmdlet%20(Get-Mailbox).%20Try%20a%3A%20Get-Mailbox%20-%20Identity%20OneUser%20and%20look%20at%20the%20returned%20result.%20It%20returns%20a%20lot%20of%20things.%20However%2C%20only%20the%20MailboxIdParameter%20parameter%20is%20strictly%20necessary%20for%20the%202nd%20cmdlet.%20%24Mailboxes%20-%20Get-Mailbox%20-ResultSize%20Unlimited%20select-object%20-property%20MailboxIdParameter%20should%20be%20significantly%20smaller.%20Then%20go%20to%20the%202nd%20cmdlet%20Get-Mailboxpermission%20to%20keep%20only%20the%20properties%20that%20interest%20you%20if%20necessary%20before%20exporting%20to%20a%20.csv.%20Looks.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-795793%22%20slang%3D%22en-US%22%3ERe%3A%20The%20total%20data%20received%20from%20the%20remote%20client%20exceeded%20the%20allowed%20maximum.%20The%20allowed%20maximum%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-795793%22%20slang%3D%22en-US%22%3E%3CP%3EThose%20one-liners%20are%20convenient%2C%20but%20they%20don't%20really%20work%20in%20scenarios%20where%20you%20have%20thousands%20and%20thousands%20of%20users%2C%20as%20you've%20already%20noted.%20Get%20the%20list%20of%20user%20mailboxes%2C%20store%20it%20in%20a%20variable%2C%20then%20do%20a%20loop%20over%20each.%20If%20that%20fails%20as%20well%2C%20minimize%20the%20amount%20of%20data%20transferred%20by%20fetching%20just%20the%20bare%20minimum%20of%20properties%20you%20need%2C%20instead%20of%20the%20200%2B%20that%20Get-Mailbox%20returns.%20This%20can%20be%20done%20by%20using%20the%20method%20detailed%20here%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FExchange-Team-Blog%2FRunning-PowerShell-cmdlets-for-large-numbers-of-users-in-Office%2Fba-p%2F604280%22%20target%3D%22_blank%22%3Ehttps%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FExchange-Team-Blog%2FRunning-PowerShell-cmdlets-for-large-numbers-of-users-in-Office%2Fba-p%2F604280%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent Contributor

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

 

2 Replies
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-numbe...