Clean out old mailbox export requests

Clean out old mailbox export requests.

Clean out old mailbox export requests.

Since Exchange 2010 doesn’t automatically remove old mailbox export requests, periodically you need to clear them out manually.

This short little script cleans out all mailbox export requests that were completed more than 7 days ago. I run it about once per week. You could also schedule it if you want.

$CompletedRequests = Get-MailboxExportRequest -Status Completed
$EndDate = (Get-Date).AddDays(-7)

$CompletedRequests | ForEach {
	if ((Get-MailboxExportRequestStatistics `
		$_.RequestGuid).CompletionTimeStamp -lt $EndDate) {
		Remove-MailboxExportRequest $_.RequestGuid `
			-Confirm:$False
		}
}

4 responses to “Clean out old mailbox export requests”

  1. MMaMMartin says:

    You can also use this powershell command:
    Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest

  2. jay c says:

    If you want to delete all Completed export requests, that will work perfectly. I like to keep them around for a little while so that whoever submitted the request has time can still see the status before it gets deleted.

  3. WingerB says:

    Hello,

    How can delete the Request ? the user in AD an Exchange is deleted.

    S C:\Windows\system32> Get-MailboxExportRequest -Status Completed | fl RequestGuid
    RequestGuid : e616187e-2bbb-452b-a791-5165541bf22a
    RequestGuid : d36f9d02-b56b-4cbb-8207-ffddac95339f

    get-MailboxExportRequest -RequestQueue standardDB

    What can i do ?

Leave a Reply

Your email address will not be published. Required fields are marked *