Search code examples
powershellcountfilteringmsmq

Filtering MSMQ Count?


I'm trying to filter the count for incoming queues and I have it printing all of the queues and the count, but I want to specifically show just the queues containing the word "dev". How would I go about this?

gwmi -class Win32_PerfFormattedData_msmq_MSMQQueue -computerName $myServer |
ft -property Name,MessageInQueue

Thanks.


Solution

  • Where-Object is what you are describing.

    Insert in your command

    Where-Object{ $_.Name -like "*dev*"} 
    

    just after $myServer |.