Quantcast
Channel: Exchange Server 2010 forum
Viewing all articles
Browse latest Browse all 19214

Interesting problem with message tracking function I wrote

$
0
0

I've run into an interesting problem that I haven't encountered before with Powershell, having to do with a simple function I wrote.  Hopefully somebody can provide some insight.

I have 10 Hub transport servers in my Exchange 2010 environment, and 4 Edge transports.   Because the 4 Edge transports are in a dmz and firewalled off, if I runget-transportservers | get-messagetrackinglog I have to wait for each of the 4 Edge servers to time out when I run a track, which is obviously not desirable.  So I put a function in my powershell profile like this (pardon the poor formatting due to the forum editor):

function get-hubs{ get-transportserver | where {$_.name -notmatch "edgenameX" -and $_.name -notmatch "edgenameY" }

When I run get-hubs it works fine and returns the list of servers I want.

When I run get-hubs | get-messagetrackinglog I get no results, and no errors.

When I run get-transportserver | where {$_.name -notmatch "edgenameX" -and $_.name -notmatch "edgenameY" | get-messagetrackinglog I get the results I expect.

So the million dollar question is, why doesn't it work when I pipe the function to the tracking cmdlet?


Viewing all articles
Browse latest Browse all 19214

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>