Exchange 2010 Powershell Scripts for Transferring Mail From Bloated Journal Mailboxes

  • 7019264
  • 23-Jan-2015
  • 07-Aug-2017

Environment


Retain
Exchange 2010
Journal Mailboxes

Situation


I have a Journal mailbox that Exchange can no longer work with due to its size.  Retain is not able to archive from it, so how do I get the items out of the bloated mailbox and get them into a new Journal mailbox chunks at a time?

Resolution


This solution was provided as a courtesy from one of GWAVA's customers using Retain with Exchange 2010.  GWAVA cannot support this or answer questions about it; again, it is provided as a courtesy to at least point you in the right direction.
Prerequisites
  • Exchange Export/Import Service Account: ExchangeServiceAccount
  • Password: NeverExpires
  • AD Security Group Memberships:
    • Discovery Management
    • Exchange All Hosted Organizations
    • Exchange Servers
    • Exchange Trusted Subsystem
    • Exchange Windows Permissions
    • Mailbox Import Export
    • Recipient Management
  • ExchangeServer: Execution Point for Export and Import PS1 Code with at least Local Admin Security on that server.
  • PS1-PST Folder: On the Exchange Server to be used for PS1 Code Execution and PST File creation by an Export then Import to an Exchange Mailbox.
  • Enable “Recipient Management†and “Discovery Mailbox†Roles using the Exchange Management Shell
    • Add-RoleGroupMember "Recipient Management" -Member ExchangeServiceAccount
    • Add-RoleGroupMember "Discovery Mailbox" -Member ExchangeServiceAccount
Script to Export
This script exports the data from the bloated Journal mailbox into a PST file.  You'll want to take it in chucks - perhaps one day at a time, depending on how bloated your Journal mailbox is.
#ENABLE EXCHANGE SHELL COMMANDS
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
#The script is dot sourced here
. $env:ExchangeInstallPath\bin\RemoteExchange.ps1
Connect-ExchangeServer -auto
Set-AdminAuditLogConfig -AdminAuditLogEnabled $False

#CONTENT FILTER VARIABLES
#-"Greater Than" date listed as MM/DD/YYYY
$GT = "[date]"
#-"Less Than" date listed as MM/DD/YYYY
$LT = "[date]"

#THE POWERSHELL COMMAND
New-MailboxExportRequest -Name [mailbox export request name of your choosing] -Mailbox[Bloated Journal Mailbox Name] -MRSServer[CAS Server Name].[Domain Container].[Domain Container] -ContentFilter {(Received -GT '$GT') -and Received -LT '$LT')} -FilePath [folder path]\[pst filename you want to create].pst

Script to Import
This script imports the data from the export file created above.
New-MailboxImportRequest -BadItemLimit 100 -AcceptLargeDataLoss -Name [mailbox import request name of your choosing] -Mailbox [New Journal Mailbox Name] -MRSServer [CAS Server Name].[Domain Container].[Domain Container] -FilePath [folder path]\[pst filename created during the export].pst


Additional Information

This article was originally published in the GWAVA knowledgebase as article ID 2446.