So, I got it in my head that it might be nice to have a script in my pocket to monitor the Exchange 2010 Mail Flow speeds. I used to have a similar script that worked with the Exchange 2007 systems that I maintain, but with the extensions of the PowerShell Snap-ins within Exchange 2010 and my better knowledge of PowerShell as a whole, I thought that I could write a better one. So here it is scratched up quick and fresh and ready to share…
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue $Servers = Get-ExchangeServer | Where-Object { $_.IsE14OrLater -and $_.IsMailboxServer } $TestPairs = @() ForEach ( $SourceServer in $Servers ) { ForEach ( $TargetServer in $Servers ) { $TestPair = New-Object -TypeName PSObject -Property @{ SourceServer = $SourceServer.Name; TargetServer = $TargetServer.Name } $TestPairs += $TestPair } } $ResultSet = @() ForEach ( $TestPair in $TestPairs ) { $ResultsObject = Test-Mailflow -Identity $TestPair.SourceServer -TargetMailboxServer $TestPair.TargetServer -ErrorAction SilentlyContinue -WarningAction SilentlyContinue if ( $ResultsObject ) { $ResultsObject | Add-Member -MemberType NoteProperty -Name SourceServer -Value $TestPair.SourceServer $ResultsObject | Add-Member -MemberType NoteProperty -Name TargetServer -Value $TestPair.TargetServer $ResultSet += $ResultsObject } } $ResultSet | Format-Table SourceServer, TargetServer, TestMailflowResult, MessageLatencyTime