The number of messages on an MSMQ via Powershell

Irwin picture Irwin · Feb 18, 2010 · Viewed 28.5k times · Source

I'd like to provide a queuepath and get the number of messages thereupon. Any advice on how this could be done?

Answer

RobO picture RobO · Jun 13, 2011

This will list all queues on a machine and the number of messages:

gwmi -class Win32_PerfRawData_MSMQ_MSMQQueue -computerName $computerName |
    ft -prop Name, MessagesInQueue