powershellexchange-server-2010exchange-server-2013

Exchange Powershell attempting to gather all mailboxes that have send as permissions granted


I am working on a migration from on premise Exchange 2010/2013 to Office 365 Exchange online. I am trying to collect a report of all mailboxes of user type and shared type that has send as permissions granted; as well as the names of the mail users that have been granted the permission. The code I am using is as follows.

#Get-Mailbox -RecipientTypeDetails SharedMailbox,usermailbox -resultsize unlimited | Get-ADPermission | where {($_.ExtendedRights -like "*Send-As*") -and ($_.IsInherited -eq $false) -and -not (($_.User -like "NT AUTHORITY\SELF") -or ($_.User -like "S-1-5-*") -or ($_.User -like "NT AUTHORITY\SYSTEM") -or ($_.User -like "BUILTIN\Administrators"))} | select User,identity | Export-Csv $outfile

The code seems to work but after a few minutes I get the following:

enter image description here

I have tried running the code from 3 different exchange servers and keep getting a variation of the same error and am at a loss. I have even tried limiting it to just users and just shared mailboxes to no avail. Any suggestions would be appreciated.


Solution

  • That particular error is pretty specific. Size quotas are preventing success.

    You can change the size to see if that resolves your issue.

    winrm get winrm/config 
    
    Default configuration
    
    Config
        MaxEnvelopeSizekb = 500
        MaxTimeoutms = 60000
        MaxBatchItems = 32000
        MaxProviderRequests = 4294967295
        Client
            NetworkDelayms = 5000
            URLPrefix = wsman
    ...
    
    
    winrm get winrm/config @{MaxEnvelopeSizekb="5000"}
    

    Update, the above should have been set not get, a bad transpose.

    winrm set winrm/config @{MaxEnvelopeSizekb="5000"}
    

    Or the cmd that the OP (CBeale) noted.

    Set-WSManInstance -ResourceURI winrm/config -ValueSet @{MaxEnvelopeSizekb = "5000"}