Introduction
Managing archive mailboxes in Microsoft 365 (Exchange Online) can sometimes feel complicated, especially if you’re new to PowerShell. But don’t worry — in this blog post, I’ll walk you through how to check the archive mailbox status and gather useful statistics using a couple of simple PowerShell commands.
This guide is designed for IT administrators, tech enthusiasts, and anyone looking to understand how to manage Exchange Online mailboxes using PowerShell. We’ll not only look at the commands, but also break down each part in plain English so that even beginners can follow along with ease.
Prerequisites
Before running the scripts below, make sure you’ve connected to Exchange Online PowerShell. If you haven’t done that yet, you can follow Microsoft’s official documentation on how to connect to Exchange Online via PowerShell. You’ll also need appropriate admin permissions.
Checking Archive Mailbox Status
Here’s the first command:
Get-Mailbox -Identity "emailaddress" | FL ArchiveStatus
Let’s break it down:
- **Get-Mailbox** : This cmdlet fetches details about a mailbox in Exchange Online.
- **-Identity “emailaddress”** : Replace ’emailaddress’ with the actual email address of the user you want to inspect.
- **| FL ArchiveStatus** : ‘FL’ stands for Format-List. This part formats and filters the output to only show the ArchiveStatus property.
This tells you whether the mailbox has an archive enabled or not.
**Example Output:**
ArchiveStatus : Active
Viewing Archive Mailbox Statistics
Now let’s take a look at the second command:
Get-MailboxStatistics -Identity "emailaddress" -Archive | Select DisplayName, TotalItemSize, ItemCount
Here’s what each part does:
- **Get-MailboxStatistics** : Retrieves statistical information about the mailbox.
- **-Identity “emailaddress”** : Again, you’ll replace this with the actual email address.
- **-Archive** : Specifies that we are targeting the archive mailbox, not the primary.
- **| Select DisplayName, TotalItemSize, ItemCount** : This selects and displays only the fields we care about — the display name, size of the archive, and number of items.
**Example Output:**
DisplayName : John Doe
TotalItemSize : 2.34 GB (2,512,345 bytes)
ItemCount : 3256
Explanation of Each PowerShell Element
These scripts are part of everyday administrative tasks for managing archive mailboxes. Knowing whether the archive is active, and how much data it holds, is essential for compliance and storage planning.
**ArchiveStatus** helps you know whether the mailbox archiving is turned on.
**TotalItemSize** gives a sense of how much space the archived emails are taking.
**ItemCount** shows how many emails or items are stored in the archive.
Final Thoughts
PowerShell is an incredibly powerful tool for managing Microsoft 365. By understanding a few key commands, you can get meaningful insights into your users’ mailboxes and archives. These scripts not only save time but also give you direct control over your environment.
Keep exploring PowerShell, and don’t hesitate to create your own custom scripts to automate repetitive tasks!