I have the following .VBS script, which works, but it only returns the top ±100(97) rows of data. How do I get the full list?
On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue",,48)
For Each objItem in colItems
Wscript.Echo objItem.Name & " - " & objItem.MessagesinQueue
Next
With a little googling I found a post by Yoel Arnon (web search says he's a guru on MSMQ), The MSMQ WMI Provider. In it he states that the MSMQ performance counters have a limitation that they only provide "the first 97 queues (local and outgoing queues) in your computer".
In the same post he provides a link to a new WMI provider he developed to overcome that limitation plus some others, as well as an email address for contact info. The post is three years old but the file is still available for download.
To accomplish what you are looking for, and the answer by Daryn about MS specifically cancelling after 97 entries, I would adjust your process into say... 2 or 3 queries...
Your query is looking for
Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue
Look for some pattern of the data that is already filling your first 97 that would be less than the 97... such as
Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue
where SomeColumn = 'Some Common Value'
then do a SECOND pass with
Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue
where NOT SomeColumn = 'Some Common Value'
This would help you get to a max of 194 entries... Find yet another "Common" element and break it into 3 passes respectively and each could be put into its own FOR/EACH loop to populate your echo list back to the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With