Understand how many emails have been sent or received by an Exchange Online Mailbox using Powershell

So had a bit of a weird question today from a colleague, who wanted a quick way to find out how many emails have been sent or received by an individual mailbox.

So Windows PowerShell to the rescue .. First of all you will need the ExchangeOnline module which can be easily installed via the following cmdlet

Install-Module -Name ExchangeOnlineManagement

https://www.powershellgallery.com/packages/ExchangeOnlineManagement/2.0.5-Preview1

Type Connect-ExchangeOnline and login using the relevant permissions

Received Message Count

# Receive Messages
$messages = Get-MessageTrace -RecipientAddress andrew.price@lyncme.co.uk -StartDate (Get-Date).AddDays(-1) -EndDate (Get-Date)
$messages.count

Sent Message Count

# Sent Messages
$messages1 = Get-MessageTrace -SenderAddress andrew.price@lyncme.co.uk -StartDate (Get-Date).AddDays(-1) -EndDate (Get-Date)
$messages1.count

You will now get a number of received and sent messages.

Regards
The Author – Blogabout.Cloud

Leave a Reply

Your email address will not be published. Required fields are marked *