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):
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.