WMI Query to count number of messages in MSMQ poison queue
I can query the Win32_PerfFormattedData_msmq_MSMQQueue WMI object to get
the count of messages on an MSMQ queue as below, however this will return
a cumulative count of messages on the queue and it's subqueues (e.g.
poison and retry). Ideally I would like to get a count of messages on the
poison queue alone.
Is this possible using WMI?
Dim Locator
Set Locator = CreateObject("WbemScripting.SWbemLocator")
Dim objs
Set Service = Locator.ConnectServer(".", "root\cimv2")
Set objs = Service.ExecQuery("SELECT MessagesinQueue " &_
"FROM Win32_PerfFormattedData_msmq_MSMQQueue " &_
"WHERE Name LIKE '%\\private$\\myqueue'")
For Each object In objs
WScript.Echo "Name: " & object.Name
WScript.Echo "MessageCount: " & object.MessagesInQueue
Next
Given the docs on subqueues this makes sense as they are just a partition
of the main physical queue, but is there any other WMI object or attribute
I can query to identify poison messages?
Subqueues are implicitly created local queues that are logical partitions
of a physical queue. Applications can use subqueues to group messages.
Subqueues are implicitly created when opened, are deleted when empty, and
have no open handles. Messages cannot be sent to a subqueue. Messages can
be received from subqueues, moved between the main queue and its subqueue,
or moved between a pair of sibling subqueues.
Subqueues do not have their own properties or state, but share the
properties and state of their parent queue. For example, a subqueue does
not have its own quota, access control list (ACL), or transactional type.
No comments:
Post a Comment