1

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.

Thomas Smyth - Treliant
  • 4,993
  • 6
  • 25
  • 36
CBeale
  • 13
  • 3
  • please add error details as text - not as image. – Patrick Artner Dec 30 '17 at 15:14
  • Any perticular reason why you are trying to put this all in a oneliner ? For scripts like these (espacially in migration scenarios) I first tend to get a full list of all mailboxes and all permissions on them (and I save it for future reference) and THEN I process this list locally with Powershell by filtering the data. – bluuf Dec 31 '17 at 07:42

1 Answers1

0

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"}
postanote
  • 15,138
  • 2
  • 14
  • 25
  • This was not quite right, but gave me the clue needed to resolve the issue. the command I used looked like this `Set-WSManInstance -ResourceURI winrm/config -ValueSet @{MaxEnvelopeSizekb = "5000"}` – CBeale Jan 02 '18 at 16:43