Get-MessageTrackingLog how to speed up

Searching message tracking logs with cmdlet Get-MessageTrackingLog can take long time when you need to search few Hub Transport Servers.

Below command will search all transport logs on all Exchange Hub Transport servers and find only messages with subject “Important *”:

Get-TransportServer | Get-MessageTrackingLog -resultsize unlimited -start (get-date).adddays(-2) -end (get-date) -eventid Deliver | ? {$_.messagesubject -like "Important *"}

 

You can speed up this search by using remoting Powershell using CMDlet Invoke-Command.

You need to modify command like below and add Invoke-Command:

Get-TransportServer | Invoke-Command {Get-MessageTrackingLog -resultsize unlimited -start (get-date).adddays(-2) -end (get-date) -eventid Deliver | ? {$_.messagesubject -like "Important *"}}