Jan 2 2018

The InnerException message was ‘Maximum number of items that can be serialized or deserialized in an object graph is ‘2000000’.

This was quite an interesting error for a mailbox I tried to migrate from Exchange 2013 to Exchange Online. The mailbox synced to 95% and I received the below error after I tried completing the batch.

Error details: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ISourceFolder_EnumerateChanges2Result. The InnerException message was ‘Maximum number of items that can be serialized or deserialized in an object graph is ‘2000000’.

The key to this error is the object graph limit that is set in the MsExchangeMailboxReplication.exe config file. To resolve the issue do the following:

  1. Logon to your on premises Exchange CAS servers that you use as the proxies for migrating mailboxes to EOL. (In my case this was Exchange 2013)
  2. Open Notepad as an administrator
  3. Browse to C:\Program Files\Microsoft\Exchange Server\V15\Bin (or your Exchange installation path) and open the MsExchangeMailboxReplication.exe config file
  4. Hit ctrl + f in Notepad and search for maxItemsInObjectGraph (there are two entries and I had to change both values)
  5. You want to increase the number in these strings:   <dataContractSerializer maxItemsInObjectGraph=”20000000″/> This is what the original looks like below.
  6. Restart the mailbox replication service on all the servers where you have changed the value.
  7. If the migration failed, then delete the migration job and restart it. You should not have the error again.
  8. Change the strings back to default using the above steps after you migrated the affected mailboxes for which you received the above error.

Here’s what the entries in the config file look like before any changes were made:

 

<behavior name=”MrsProxyServiceBehavior”>
<serviceDebug includeExceptionDetailInFaults=”True” />
<serviceAuthorization serviceAuthorizationManagerType=”Microsoft.Exchange.MailboxReplicationService.MRSProxyAuthorizationManager, Microsoft.Exchange.MailboxReplicationService.ProxyService, Version=15.0.0.0, Culture=neutral, PublicKeyToken=%%%%%%%”/>
<serviceThrottling
maxConcurrentCalls=”200″
maxConcurrentSessions=”200″
maxConcurrentInstances=”200″ />
 <dataContractSerializer maxItemsInObjectGraph=”20000000″/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name=”MrsProxyEndpointBehavior”>
 <dataContractSerializer maxItemsInObjectGraph=”2000000″/>


Jan 10 2017

Removing mail with the same subject from the Exchange Queues

Sometimes you need to remove thousands of e-mails in your Hub Transport server queues. We see this every now and then with mail storms from an application that went off the rails or maybe with 2 mailboxes sending each other auto replies causing a mail loop.

There’s a few ways to stop the mail storm before removing the mail items in your Exchange queues but that is not the scope for this article. If you are ever in the situation of thousands of mails queued on all your Hub Transport servers then the below cmdlet should help you to quickly remove those mails from the queue. (Obviously do this with mails that are not classified as normal business or valid mail i.e. auto response loops)

  1. Get-TransportServer HubTransportServerName| Get-Queue | Get-Message -ResultSize unlimited | where {$_.Subject -eq “Paste the subject you need removed here.”} | Remove-Message -WithNDR $False

a better way might be #2 below if you don’t want to confirm deletion and have to run it across all your Hub Transport Servers: (Thanks to Clinton Hardenberg for the updated cmdlet)

2. Get-TransportServer HTServer0* | Get-Queue |where {$_.MessageCount -gt 25} | Get-Message -ResultSize unlimited | Where {$_.Subject -eq “Paste the subject you need removed here.”} |            Remove-Message -WithNDR $False -Confirm:$false

The 2nd cmdlet will use the 1st part of your server names i.e. if you have HT01, HT02 and HT03 then use HT0* to remove the mail across all your HT servers. The -WithNDR $False will delete the mail and not send an NDR which is important in this case as you will just increase the number of mails when it’s set to $True. -Confirm $False negates the need to select “A” and confirm that you want to remove the mail items from the queues.

There are other parameters you can use to define which items you want to remove but in the above examples we use the Subject as we deal mostly with mail storms by Subject as they are usually

 


Jul 26 2013

Meeting requests sent to a room mailbox, replaces the Subject, with the Senders name

We received a call today where a meeting request sent to a Room mailbox shows the meeting organiser’s name in the subject line.
This can be rectified by running the following:

Exchange 2010/2013:

Set-CalendarProcessing -identity “meeting room name” -DeleteComments $true -AddOrganizerToSubject $true -DeleteAttachments $true -DeleteSubject $true

Exchange 2007:

set-mailboxcalendarsettings -identity “meeting room name” -deletesubject $false -addorganizertosubject $false

Hope this makes your life a bit easier.