Enable M365 Mailbox Archiving Using PowerShell

Following our previous post on archiving, today we will show how to enable archiving on a mailbox hosted on Microsoft 365 using PowerShell.

If you would like to use the Microsoft 365 portal to enable archiving, visit this post.

Enable Archiving

Before enabling archiving, you can first check all the users that have archiving enabled on their mailboxes using the following command.

Get-Mailbox -resultsize unlimited -Archive

To check if archiving is enabled on a specific mailbox, run the following command with a user UPN.

Get-Mailbox -Identity john.smith@domain | select archive*

To enable archiving on a single mailbox, run the following command.

enable-Mailbox -Identity john.smith@domain -Archive

After running the command, the output would look like the screenshot below.

To enable archiving on all the mailboxes in the organisation, use this command.

Get-Mailbox -resultsize unlimited -Filter {ArchiveGuid -eq "00000000-0000-0000-0000-000000000000" -and RecipientTypeDetails -Eq "usermailbox"} | enable-mailbox -Archive