Mails stuck after enabling Public Folders replication

I was dealing with an interesting issue the other night, thought I’d share to solution.
A client of mine called me said his emails are stuck, the queues are filling up with thousands of emails and he can sent nor receive anything.
A bit of a background – all the clients mailboxes are resided on a single all-in-one Exchange 2007 server, the old Exchange 2003 server is still online, and it holds several mailboxes and does some routing.
My client suspected that he was missing a Public Folder item which he thought he could find on the PubDB located on the 2003 server. As soon as he mounted that DB, the queues were filling up pretty quickly with Public Folder replication massages. I guess there was something bad with that old DB. As a result of that and the fact that the queues DB resided on C drive, the drive exploded.
To solve this issue we started by disabling the Public Folder replication:
1.  On the 2003 server Exchange System Manager, right click the organization name and choose to stop replication.
2. On the 2007 server, open up powershell and write – ‘Suspend-PublicFolderReplication’
Basically doing just one of the above should be suffice, but I did both – just in case…
The next step was to clear up the messages already stuck in the queue. This can be done manually, but since there were over 60,000 messages stuck there I decided to use powershell for the task:
‘Get-Message -Filter {FromAddress -like “*PublicFolder*”} | Remove-Message –WithNDR $False’
Notice here the “-WithNDR $False” which is pretty important of obvious reasons.
Next step was to move the Queue to another drive. if your Exchange server version is higher than 2007 SP1, then you can use a nice script provided by Microsoft called Move-TransportDatabase.ps1
If not, you will need to do it manually – you can read more about both methods over here:

Once we did all of the above, the queue for free to process other more ‘legit’ emails.
I then suggested my client to use backup/restore procedures to extract any missing folders from the old DB, or simply mounting it while offline and extracting the content to a PST.

Incoming search terms:

  • Can I delete public folder replication emails

What do you think about this post?