Get-MessageTrackingLog against all Exchange Servers For Bulk a List of e-mail addresses EX 2016

MTS 26 Reputation points
2023-11-02T16:16:36.6366667+00:00

I have been trying to perform this action using various scripts but i cant seem to get it all together working correctly.

i basically need to run a message tracking log against 300 mailboxes that sit across 8 exchange servers.

any help would be greatly appreciated

i stripped it back down to do a test for one mailbox as follows

Get-OPTransportServer | Get-OPMessageTrackingLog -Start "05/01/2023 09:00:00" -End "11/02/2023 17:00:00" -Recipients t******@test.com

which is giving me message trace results but basically i need to apply that to a list of mailboxes from a CSV

Windows for business | Windows Server | User experience | PowerShell
Windows for business | Windows Server | User experience | Other
Exchange | Other
{count} votes

Accepted answer
  1. Yuki Sun-MSFT 41,376 Reputation points Moderator
    2023-11-03T02:33:02.5866667+00:00

    Hi @MTS

    i basically need to run a message tracking log against 300 mailboxes that sit across 8 exchange servers.

    Prepare a csv file for the mailboxes list using format below (a column header named "Email" and a row for each mailbox email address):
    User's image

    Then you can use the following scripts to retrieve all the message tracking logs and export the result into a csv file:

    $Mailboxes = Import-Csv -Path "C:\Mailboxes.csv"   
      foreach ($Mailbox in $Mailboxes) {         
           Get-TransportService | Get-MessageTrackingLog -Start "05/01/2023 09:00:00" -End "11/02/2023 17:00:00"  -Recipients $Mailbox.Email -ResultSize Unlimited |sort-object Timestamp | Export-Csv -Path "C:\TrackingLogs.txt"}
    

    Note: Considering that the tracking logs contain multiple lines for each mail, and you are trying to run the command against 300 mailboxes over a period of several months, the output could be quite huge. So personally, I'd recommend trying to shorten the time range or add some more filter like -EventID "RECEIVE" after the Get-MessageTrackingLog.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.