Exchange Troubleshooting: remove-mailboxexportrequest mailbox guid must not be empty
When an employee leaves the company, usually there is what is called the leaver’s procedure which one step of the procedure is to extract and archive a copy of their mailbox. Another reason why we would extract a mailbox is for archiving a particular year or to remove old mailboxes from cluttering the Exchange Server and export them to PST.
When a mailbox is extracted with Exchange Server’s native PowerShell tools using the New-MailboxExportRequest cmdlet as below, after completion or progress it will not delete the requests as by design so that you will have a trail of which mailboxes have been extracted.
New-MailboxExportRequest –Mailbox "user1" –FilePath \\ex01\PstFiles\User1.pst
When the process is complete and we want to check the progress, we use the Get-MailboxExportRequest PowerShell cmdlet as below.
After extracting quite a bit of users the result from the Get-MailboxExportRequest can become a bit of a mess as you will end up with an endless list. To purge the list of exports you must use the Remove-MailboxRequest PowerShell cmdlet. To remove the completed or failed requests you can use the below commands.
Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest
Get-MailboxExportRequest -Status Failed | Remove-MailboxExportRequest
Till now all good until you run a Remove-MailboxExportRequest and you will be presented with an error saying “Mailbox GUID must not be empty”.
First of all why something that has been completed or failed not being able to delete the request? Looking a bit into it, the issue might be of either the mailbox or the Active Directory user does not exist anymore. For example the user left the company, mailbox has been extracted, mailbox deleted and in the end, the user in the system has been deleted.
You would notice this because when you run the Get-MailboxExportRequest you get the following line where the mailbox would be empty.
First thing to try is to force a removal with the command below.
Get-MailboxExportRequest | Remove-MailboxExportRequest –Force
If this fails, one can try to create a new user in the Active Directory and create a mailbox with the same name. After the creation you can try to remove the request.
If this fails one can try to dismount the mailbox database.
Open the Exchange Admin Center (EAC) and click on servers. Click on Databases and click on the mailbox database. Click on the three dots menu and click onDismount.
Wait a minute or two and redo the same procedure and this time you will have the Mount button. After a few minutes and the database has mounted you could try to run the removal again.
If this fails again, there is one more thing to try which is by using the ADSIEdit. An important notice before going further. Any changes here are effective immediately and there is no undo. Making a mistake here could hinder your Exchange/ Operating system and leave you with an unusable server. Be careful and follow instructions carefully.
Open the ADSIEdit by typing **ADSIEdit.msc **in your search as below and open the application.
Once open, right-click on ADSI Edit and click Connect to. Change the Naming Context to Configuration and click on OK.
Once open expand Configuration, CN=Configuration, CN=Services, CN=Microsoft, CN=Exchange, CN=Organization Name, CN=Mailbox Replicationand CN=MailboxExportRequest.
Here you will find all the exports that were done by the server, right click on the one which is giving you problems and delete it. Since this is an error which could also occur on mailbox imports using the** New-MailboxImportRequest** and Remove-MailboxImportRequest, to manually remove the entry from the ADSIEdit you need to take the same path but at the end of the** CN=MailboxImportRequest **and delete the culprit GUID. You can check complete mailbox export & import steps from here.