Recently I was doing some testing with a new Exchange 2010 Receive Connector and wanted a method to check how many messages it was processing. I came up with the following Powershell snippet that seems to work well.
$i = 0 do { $now = get-date (Get-MessageTrackingLog -ResultSize unlimited -Start "11/10/2012 3:00PM" -End $now -Server MYSERVER ` | ? {$_.connectorid -eq "MYSERVER\SMTP Relay"}).count sleep 30 $i = $i + 1 $i } until ($i -eq 100)
The script uses the “do until” method to query the message tracking logs on a specific server at 30 second intervals for instances of the Receive Connector and displays the count. It does this a hundred times (or until you stop the script).
Nice, but why not clean up $i = $i 1 to just read $i
but both methods work
It appears the plus signs were stripped from my comment. “$i ” versus “$i = $i 1”
placed quotes around it hoping it won’t get stripped out this time.