Archive mailboxes in Microsoft 365 Exchange Online – PoweShell method

Archive mailboxes in Microsoft 365 Exchange Online – PoweShell method

 

Email inboxes are becoming increasingly cluttered with data as businesses rely more and more on digital communication. Without proper management of email data, performance may suffer and compliance risks may arise. Using Archive Mailboxes in Microsoft 365 Exchange Online is one way to manage this.

 

Although Exchange Online offers users a large mailbox, many organizations still need to manage the amount of data stored in their email accounts in order to prevent data loss and improve performance. With Exchange Online's Archive Mailboxes, older emails can be stored that aren't frequently accessed, but must be kept for compliance or other reasons. Our goal here is to help you learn how to archive your Exchange Online mailboxes using PowerShell.

 

 Use cases 

Here are 5 use cases for managing Archive Mailboxes in Microsoft 365 Exchange Online using PowerShell:

 

  1. Managing employee mailboxes: For legal or compliance purposes, an employee's mailbox may contain sensitive information that needs to be kept after they leave the company. It is possible to ensure that the data is still accessible while freeing up the primary mailbox for use by another employee by moving the mailbox to an Archive Mailbox.

  2. Reducing load on primary mailboxes: As mailboxes grow in size, they can become harder to access and search. You can improve the performance of your primary mailbox and reduce the risk of data loss or corruption by moving older or less frequently accessed emails to an Archive Mailbox.

  3. Ensuring compliance and e-discovery readiness: You can ensure that you have a complete record of all email communications if you place a copy in an Archive Mailbox, which can be important during legal or regulatory audits.

  4. Managing email data storage: In order to ensure that you do not exceed your storage limit for the mailbox plan, you should monitor the size of your Archive Mailboxes and adjust your plan accordingly.

  5. Using retention policies: Instead of manually moving older emails to the archive mailbox, you can use retention policies. As a result, you can save time and ensure the proper management of your email data.

 

 Steps to archive mailboxes in Microsoft 365 Exchange Online  using PowerShell

 

 Step 1: Install the Exchange Online PowerShell Module 

The first step is to install the Exchange Online PowerShell Module, which is used to manage Exchange Online through PowerShell. To do this, open PowerShell as an administrator and run the following command:

 

Install-Module -Name ExchangeOnlineManagement

 

 Step 2: Connect to Exchange Online 

Next, we need to connect to Exchange Online using PowerShell. To do this, run the following command:

 

Connect-ExchangeOnline

 

You will be prompted to enter your credentials. Enter your email address and password for your Exchange Online account.

 

 Step 3: Create an Archive Mailbox 

Now that we are connected to Exchange Online, we can create an Archive Mailbox. To do this, run the following command:

 

New-Mailbox -Name "ArchiveMailboxName" -UserPrincipalName ArchiveMailboxUPN@yourdomain.com -Archive

 

Replace "ArchiveMailboxName" with the name you want to give your archive mailbox, and "ArchiveMailboxUPN@yourdomain.com" with the user principal name for the archive mailbox. The "-Archive" parameter is used to indicate that this mailbox is an Archive Mailbox.

 

 Step 4: Assign Permissions to the Archive Mailbox 

By default, only the owner of the archive mailbox has access to it. However, we may want to grant other users access to the archive mailbox. To do this, run the following command:

 

Add-MailboxPermission -Identity ArchiveMailboxUPN -User UserUPN -AccessRights FullAccess

 

Replace "ArchiveMailboxUPN" with the user principal name for the archive mailbox, and "UserUPN" with the user principal name for the user you want to grant access to. You can grant other access rights, such as read or write access, by modifying the "-AccessRights" parameter.

 

 Step 5: Move Emails to the Archive Mailbox 

Now that we have created the archive mailbox and granted access to it, we can move emails to the archive mailbox. To do this, we will use the New-MailboxExportRequest cmdlet. Run the following command:

 

New-MailboxExportRequest -Mailbox UserUPN -ContentFilter {(Received -lt '01/01/2022')} -IsArchive -FilePath "\\ServerName\ShareName\Archive.pst"

 

Replace "UserUPN" with the user principal name for the mailbox you want to archive, and "01/01/2022" with the date you want to use as the cutoff for archiving emails. Replace "\ServerName\ShareName\Archive.pst" with the UNC path to the location where you want to save the archive file. The "-IsArchive" parameter is used to indicate that we are exporting to an archive mailbox.

 

 Step 6: Verify the Archive 

Finally, we can verify that the archive mailbox has been populated with the emails we moved. To do this, we can use the Search-Mailbox cmdlet. Run the following command:

 

Search-Mailbox -Identity ArchiveMailboxUPN -SearchQuery 'Received:01/01/2022..01/01/2023'

 

This will search for all emails received between January 1, 2022, and January 1, 2023, in the archive mailbox. If the search returns the expected results, then we can be sure that the archive mailbox has been properly populated.

 

 Things to keep in mind 

In addition to the steps outlined above, there are a few other things to keep in mind when working with Archive Mailboxes in Exchange Online:

 

  • Archive Mailboxes count towards the storage limit for the mailbox plan, so be sure to monitor the size of your Archive Mailboxes and adjust your plan as needed.

  • You can use retention policies to automatically move older emails to the archive mailbox, rather than manually moving them. This can save time and ensure that your email data is properly managed.

  • Archive Mailboxes are only available for Exchange Online Plan 2 and Microsoft 365 E3/E5 subscribers. If you are using a different subscription plan, you will not have access to Archive Mailboxes.

  • You can use the Search-Mailbox cmdlet to search for specific emails in an Archive Mailbox, which can be useful for compliance or e-discovery purposes.

 

You can effectively manage your email data in Exchange Online using Archive Mailboxes if you follow these steps and keep these considerations in mind. In comparison with the Exchange Admin Center web interface, PowerShell provides a powerful and flexible way to manage Exchange Online.

 

 Additional Tips 

  1. You can use the Get-Mailbox cmdlet to retrieve a list of all mailboxes in your Exchange Online organization.

  2. If you need to move a large amount of data to the archive mailbox, you can use the New-MailboxImportRequest cmdlet instead of the New-MailboxExportRequest cmdlet.

  3. You can use the Set-Mailbox cmdlet to modify the properties of an archive mailbox, such as the size limit or retention policy.

  4. It is important to review regularly and manage your archive mailboxes to ensure that they are properly organized and do not contain unnecessary data.

 

 

 Conclusion 

To conclude, Archive Mailboxes are a useful feature in Exchange Online for managing email data. It is easy to create and manage archive mailboxes, grant permissions, and move emails to the archive using PowerShell. Exchange Online's performance can be improved by reducing the risk of data loss or corruption. By following these steps, you can easily manage and organize your email data according to your business needs.

    • Related Articles

    • Top 5 Mailboxes in Microsoft 365 Exchange Online – GUI method

      Microsoft 365 Exchange Online offers various types of mailboxes that serve different purposes, from archive mailboxes to inactive mailboxes. Each mailbox type has unique features and functionalities that can help improve email management in your ...
    • Microsoft 365 Exchange Online - Shared Mailboxes & PowerShell

      Introduction Overview of Shared Mailboxes A shared mailbox in Microsoft 365 Exchange Online allows multiple users to access and manage emails, contacts, and calendar events from a single mailbox. It is commonly used by teams that need to collaborate ...
    • Microsoft 365 Exchange online - Shared Mailboxes & PowerShell

      Introduction Overview of Shared Mailboxes A shared mailbox in Microsoft 365 Exchange Online allows multiple users to access and manage emails, contacts, and calendar events from a single mailbox. It is commonly used by teams that need to collaborate ...
    • How to find unused Exchange Online mailboxes using PowerShell

      What are unused Exchange Online mailboxes and how to identify them? Unused Exchange Online mailboxes are user mailboxes which are currently not being used by their users. There are 3 ways in which we can identify if a mailbox is unused or not. They ...
    • Introduction to Microsoft 365 Exchange Online

      Microsoft 365 Exchange Online is a cloud-based email solution that offers advanced features and functionality for managing email, contacts, calendars, and tasks. As an administrator, it is essential to have a comprehensive understanding of these ...