To show total number of mails in Pending status in Exchange Online

Niranjan T Pattana Shetty 286 Reputation points
2020-11-14T12:37:41.643+00:00

Hi All,
Due to some DNS reason we have mails stuck in our Exchange online queue in Pending status.
Now, I want to know the total number of mails that are stuck with Pending status.

All I could do was the below command
(Get-MessageTrace -Status pending -PageSize 5000 -Page 1).count
This lists 5000 which is obvious as I suspect that the numbers are in 20000s , so what would be the command to display the count?

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,173 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,345 questions
Microsoft Exchange Hybrid Management
Microsoft Exchange Hybrid Management
Microsoft Exchange: Microsoft messaging and collaboration software.Hybrid Management: Organizing, handling, directing or controlling hybrid deployments.
1,885 questions
{count} votes

Accepted answer
  1. Andy David - MVP 141.5K Reputation points MVP
    2020-11-14T12:43:11.787+00:00

    Something like this with $page set to 1 to start. Modify as needed
    https://www.quadrotech-it.com/blog/office-365-mail-traffic-statistics-by-user/

    do
    {
    $CurrMessages = Get-MessageTrace -Status pending -PageSize 5000 -Page $Page | Select Received,SenderAddress,RecipientAddress,Size
    $Page++
    $Messages += $CurrMessages
    }
    until ($CurrMessages -eq $null)
    

0 additional answers

Sort by: Most helpful