如何从 WMI 中获取超过 97 行?

发布于 2024-12-21 21:41:49 字数 409 浏览 0 评论 0原文

我有以下 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娜些时光,永不杰束 2024-12-28 21:41:49

通过谷歌搜索,我找到了 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.

疑心病 2024-12-28 21:41:49

为了完成您正在寻找的内容,以及 Daryn 关于 MS 在 97 个条目后明确取消的答案,我会将您的流程调整为... 2 或 3 个查询...

您的查询正在寻找

Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue

寻找数据的某种模式已经填满了小于 97 的第一个 97...例如,

Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue 
     where SomeColumn = 'Some Common Value'

然后执行第二遍,

Select * from Win32_PerfFormattedData_MSMQ_MSMQQueue 
     where NOT SomeColumn = 'Some Common Value'

这将帮助您获得最多 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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文