开发者

What are some common WMI queries [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 2 years ago.

Improve this question

I'm building a C# monitor app which uses WMI to grab some performance details of a remote computer. What are some good WMI queries to grab helpful stats such as CPU load, RAM usage, HDD free space, 开发者_运维技巧etc.

For example, you can get the CPU load from the property "LoadPercentage" with the query "SELECT * FROM Win32_Processor".

What are some other useful properties & queries?


I think it's a bit complicated recommend a couple of classes in particular because the WMI is extensive and depends on the type of information you wish to obtain.

My recommendation is that you see the following links.

  • WMI Reference
  • WMI Classes
  • WMI Win32 Classes


Several classes are used for what you are asking for. I think a good place to start is to separate your (mostly) static classes from your performance classes.

Static

  • Computer System - Win32_ComputerSystem
  • Operating System - Win32_OperatingSystem
  • Processor Info - Win32_Processor
  • HDD - Win32_DiskDrive
  • Disk Partitions - Win32_DiskPartition
  • Logical Disks - Win32_LogicalDisk
  • Logical Disk to Partition - Win32_LogicalDiskToPartition
  • Memory - Win32_PhysicalMemory, Win32_PhysicalMemoryArray
  • Network - Win32_NetworkAdapter (this class has a high cpu penalty if called too often), Win32_NetworkAdapterConfiguration

Performance Counters

  • Processor Utilization - Win32_PerfRawData_PerfOS_Processor
  • Memory Utilization - Win32_PerfRawData_PerfOS_Memory
  • Network Utilization - Win32_PerfRawData_Tcpip_NetworkInterface

There are many more, but these will cover what you are asking for.


You would appreciate http://gallery.technet.microsoft.com/scriptcenter/en-us. It's very nicely organized. I got all the queries for the above stats you mentioned from that website, and basically just copied and pasted.


You can Also use Win32_Products.

This gives you all istalled software on the machine. You can use WMI to repair / Uninstall these products. Very useful on Remote Machines.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜