Monday, February 11, 2013

Fix Infinite Folder Loop in Outlook - Exchange 2010

Occasionally users will manage to get an infinite folder loop in their mailbox. This is caused by a sub-folder being moved into one of its sub-folders. The folder structure will replicate, and replicate and replicate, etc... until it eventually errors our or stops. Using New-MailboxExportRequest doesn't work, attempting to fix through MFCMAPI doesn't work.

Another admin went through the same experience and documented his attempts. Check them out here

I add another solution to the mix that should be up there for last-ditch effort

This involves the following steps

  • Use Search-Mailbox cmdlet to export all mail from the source account to a stub mailbox
  • Disconnect source mailbox and connect new mailbox
  • Configure new mailbox with the email addresses from the old mailbox (X400, SMTP, X500, etc)
  • Export stub mailbox to PST (New-MailboxExportRequest)
  • Import PST to new mailbox (New-MailboxImportRequest)
  • Move folders from import (Under /Recovered Mail) to existing folders (Inbox, Contacts, Calendar, etc)

Here's the cmds that will help you along this path

$idb="UserA"$mailbox="StubMailbox"$servername = "Server" #Get User Information$mbx=get-mailbox $idb$user=Get-User $idb #Search items from Old mailbox to new mailboxsearch-mailbox -Identity $idb-TargetMailbox $mailbox-TargetFolder RecoveredMail
 #Disconnect the current mailboxDisable-Mailbox -Identity $idb -Confirm:$false#Create a new mailboxEnable-Mailbox -Identity $user -Database $mbx.Database.Name -Alias $mbx.alias -PrimarySmtpAddress $mbx.primarySMTPAddress
 #Allow AD time to catch upsleep 120
 #Add SMTP Addresses from old mailbox to new mailbox - After Search is completedSet-Mailbox -Identity $idb -EmailAddresses $mbx.EmailAddresses
 #Export mbx to PST$filepath=("\\{0}\c$\exports\{1}.pst" -f $ServerName, $mbx.Alias)
$request=New-MailboxExportRequest -FilePath $filepath -mailbox $mailbox $requestStatus=get-mailboxexportrequest $request.RequestGuid
while ($requestStatus.Status -notmatch "Completed"){
#Check every 5 minutes       $requestStatus=get-mailboxexportrequest $request.RequestGuid
       Write-Output ("Checked at {0} : {1}" -f (Get-Date), $request.Status)
       Sleep 300
}Write-Output "Export finished" #Wait for export to finish$request=New-MailboxImportRequest -FilePath $filepath -mailbox $idb $requestStatus=get-mailboximportrequest $request.RequestGuid
while ($requestStatus.Status -notmatch "Completed"){
#Check every 5 minutes       $requestStatus=get-mailboximportrequest $request.RequestGuid
       Write-Output ("Checked at {0} : {1}" -f (Get-Date), $request.Status)
       Sleep 300
}Write-Output "Import finished"

No comments:

Post a Comment