如何从 WMI 中获取超过 97 行?
我有以下 .VBS 脚本,它可以工作,但它只返回前 ±100(97) 行数据。我如何获得完整列表?
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过谷歌搜索,我找到了 Yoel Arnon 的帖子(网络搜索显示他是 MSMQ 的大师),MSMQ WMI 提供程序。他在其中指出,MSMQ 性能计数器有一个限制,即它们仅提供“计算机中的前 97 个队列(本地和传出队列)”。
在同一篇文章中,他提供了一个新的链接他开发了 WMI 提供程序来克服该限制以及其他一些限制,以及用于联系信息的电子邮件地址。该帖子已有三年历史,但该文件仍然可供下载。
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.
为了完成您正在寻找的内容,以及 Daryn 关于 MS 在 97 个条目后明确取消的答案,我会将您的流程调整为... 2 或 3 个查询...
您的查询正在寻找
寻找数据的某种模式已经填满了小于 97 的第一个 97...例如,
然后执行第二遍,
这将帮助您获得最多 194 个条目...找到另一个“公共”元素并将其分解为分别3次,每一次都可以放进入其自己的 FOR/EACH 循环以将回显列表填充回用户。
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
Look for some pattern of the data that is already filling your first 97 that would be less than the 97... such as
then do a SECOND pass with
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.