Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some common WMI queries [closed]

Tags:

c#

wmi

wmi-query

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?

like image 259
mike Avatar asked Jan 29 '26 03:01

mike


2 Answers

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
like image 129
RRUZ Avatar answered Jan 31 '26 15:01

RRUZ


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.

like image 34
Xcalibur37 Avatar answered Jan 31 '26 17:01

Xcalibur37



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!