English 中文(简体)
Slow WMI request onWindows 2008R2
原标题:Slow WMI request on Windows 2008R2
  • 时间:2011-11-23 14:51:49
  •  标签:
  • wmi

是否有人提出任何建议,以加快这一海事调查? 我每5秒更新一次客户申请,以显示邮联的状态。 视窗2003年较快,但至少需要5秒才能恢复4个信标核心的立体:

Private Sub GetProcessorIdleTime(ByVal Server As String) 

        Dim searcher As New ManagementObjectSearcher("\" & Server & "
ootCIMV2", "SELECT LoadPercentage FROM Win32_Processor")
        Dim collection As ManagementObjectCollection = searcher.[Get]()

        For Each row In collection
            TextBox1.Text = TextBox1.Text & vbCrLf & Convert.ToInt32(row("LoadPercentage"))
        Next

End Sub

还是有更好的办法远程检索这些信息?

最佳回答

To improve the performance, you must re-use the WMI connection to the remote server, establishing a connection is one of the more expensive tasks when you execute a WQL sentence. In your code you are setting a new WMI remote connection each time. So rewrite your code creating a new method to establish the remote connection and then reuse (share) the ManagementObjectSearcher object in your GetProcessorIdleTime method.

问题回答

暂无回答




相关问题
How can I query NTFS disk quotas in C#?

I need to be able to find, for all users on a given remote machine, those users disk quotas and actual disk usage. I need to be able to do this reporting in a C# application. (Well, technically a DLL ...

WMI Poor Performance

I wrote a code in C# that maps logical drives to their physical disks, using WMI (System.Management). The code working perfectly, but slow like hell. In my machine (Windows 7 x64, Dual-Core with 3 GB ...

Closing Open Files using C#

I have a situation where people are connected to files on a share and it s blocking me from overwriting the file. I m trying to write a method that will look to see if a filePath that I provide is ...

Binding an SSL certificate to a port programmatically

I m working on a self-hosted WCF service for which encrypted communications is an option. Everything works fine when a certificate is already bound to the port as described here. However, I want to ...

热门标签