How to get Windows system information?

Tim Golden tjgolden at
Sun Jan 15 10:39:27 CET 2006

[posting through Google; not sure how it will format]

re info on WMI website: please note that the examples I
give no the WMI pages are *nowhere near* exhausting
what WMI can do. They don't even scratch the surface.
And I all too rarely add to them.

If you look around the net, you'll find absolutely loads
of recipes for doing things with WMI. And it's usually
easy to translate them into Python. So, for example,
Googling for WMI CPU load takes you straight to
this page:

which (after some fairly intrusive boilerplate stuff)
ends up selecting from Win32_Processor. So, in

import wmi
c = wmi.WMI ()
for i in c.Win32_Processor ():
  print i

# gives, among other things, a LoadPercentage
# field.

Now, what the different fields mean sometimes requires
a bit more research. But the Microsoft WMI pages
sometimes hit the spot, and indeed, a search for
WMI LoadPercentage

brings up this page:

with a useful snippet on using WMI events to monitor
CPU Load.

And so on. By and large, whatever you can think of doing
with WMI, someone's done before. And if someone's done
it in VBS (or Perl, or whatever), we can do it in Python.


More information about the Python-list mailing list