Speed Up Multi-Server Message Tracking Log Searches with PowerShell Remoting

In several recent articles I’ve demonstrated different techniques for searching message tracking logs using PowerShell.

In each of those examples we mostly looked at searching the logs on a single Hub Transport server.

If your Exchange Server environment has more than one Transport server then you’ll often need to run message tracking log searches across multiple servers at once.

One of the simplest ways to do this is by piping the output from Get-TransportServer into the Get-MessageTrackingLog command.

[PS] C:\>Get-TransportServer | Get-MessageTrackingLog -MessageSubject "meeting" -resultsize unlimited}

If you’re running older Exchange Server 2007 hosts with PowerShell v1.0 on them then that is your only option for multi-server searches, and I recommend you use date/time ranges to speed up searches if you need to.

However if you have PowerShell v2.0 on your servers, then you can speed up your searches quite a lot by using PowerShell remoting.

Compare the time taken for these two searches of the same set of Transport servers.

[PS] C:\>measure-command {Get-TransportServer | Get-MessageTrackingLog -MessageSubject "meeting" -resultsize unlimited}

Seconds           : 25

[PS] C:\>measure-command {Get-TransportServer | Invoke-Command {Get-MessageTrackingLog -MessageSubject "meeting" -resultsize unlimited}}

Seconds           : 3

That is 25 seconds vs 3 seconds, a clear speed advantage using PowerShell remoting. And this is just in a relatively small test lab environment. Scale out to larger environments with a real world volume of message tracking logs to search through and you can see that a lot of time will be saved using remoting for multi-server message tracking log searches.

Comments

  1. shimon cohen says

    if you want to speed up you can use jobs
    this will really speed up (i have a script that check in 10 hubs and the difference is amazing 1/10)

Leave a Reply

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