Occasionally, the need may arise to generate a new online archive mailbox for an Office 365 user. According to Microsoft, archive mailboxes become disconnected when they are disabled. The disconnected archive will be retained for 30 days by default and subsequently purged.
In some cases, you may not be able to wait the 30 days for the purge to happen automatically. For cloud-only accounts, using the ‘Disable-Mailbox’ command with the ‘Archive’ and ‘IgnoreLegalHold’ switches will remove the archive mailbox in such a way that it can no longer be found.
This is great except if you enable the online archive for the mailbox again, mysteriously the archive that moments ago could not be found, is reattached.
Thankfully, the ‘Set-Mailbox’ command contains a switch, ‘RemoveDisabledArchive’ that corrects the problem.
Note: This article applies to Cloud-Only accounts in O365, if you are using AAD Connect with an on-premises environment, you can do the following:
- Run the ‘Disable-RemoteMailbox’ command from Exchange on-premises against the mailbox in question passing the ‘Archive’ switch
- Example: Disable-RemoteMailbox firstname.lastname@example.org -Archive
- Once disabled, go to on-premises Active Directory and clear the ‘DisabledArchiveGuid’ attribute
- Run the ‘Enable-RemoteMailbox’ command from Exchange on-premises against the mailbox in question passing the ‘Archive’ switch
- Example: Enable-RemoteMailbox email@example.com -Archive
- When the object syncs, the attribute will clear out on the O365 object thus creating a brand-new online archive mailbox in Exchange online
These steps should help in situations where a new online archive mailbox is needed in a timely manner and waiting 30 days for the automatic purge is not an option.