Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Say I use Get-Queue -Server HT1 to pull up the queue on server transport1. It outputs something like this:

Identity       DeliveryType Status MessageCount NextHopDomain   
--------       ------------ ------ ------------ -------------   
HT1\47782      MapiDelivery Ready  0            mail1.c...
HT1\47783      MapiDelivery Ready  2            mail4.c....
HT1\48599      MapiDelivery Ready  0            mail2.c...
HT2\Submission Undefined    Ready  4            Submission    
HT2\47782      MapiDelivery Ready  0            mail1.c...
HT2\47783      MapiDelivery Ready  1            mail4.c....
HT3\48599      MapiDelivery Ready  0            mail2.c...
HT3\Submission Undefined    Ready  4            Submission

Is there a way to implement a loop or some logic so that I can get a cleaner one line output with a total queue count, even if I was to get the queue status on all transport server, something like this:

Server Queue

HT1      2
HT2      0
HT2      20
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Try with this:

Get-Queue | Group-Object {$_.Identity.Server} | Select-Object Name,@{n="MessageCount";e={($_.group | Measure-Object MessageCount -sum).sum}}
share|improve this answer
    
+1, but you need to change $. to $_. –  Doug Luxem Aug 19 '09 at 18:23
    
Thanks, it was consumed by the editor :) –  Shay Levy Aug 19 '09 at 20:10
    
Perfect, thank you! Gives me a nice and simple display now! –  Agent Aug 20 '09 at 14:50
add comment

Partial answer, you could apply a filter, such as

get-queue -server HT1 -Filter {MessageCount -gt 5}

this would only display results with messages greater than 5 in domain hop.

share|improve this answer
    
Thanks, that gets me closer to what I'm looking for but sometimes a couple of the queues are backed up, in which case there would still be 2 or more lines for it. –  Agent Aug 18 '09 at 15:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.