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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top