Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Anyone using a Python script to monitor CPU usage on a Windows machine ? i've google for some time but have not been able to find any usable script. could you guys show me some example of what you're using ?

Here is the errors i got.

    Traceback (most recent call last):
  File "", line 1, in 
    import wmi
  File "c:\Python26\lib\site-packages\", line 141, in 
    from win32com.client import GetObject, Dispatch
ImportError: No module named win32com.client
share|improve this question
Did you install pywin32? – Alex J Jun 7 '09 at 14:34
howdy, i installed win32 on another machine and it works like a charm. for my developing app i decided to use perl instead, since the ActivePerl package installer is very easy to use, and permits me to search and add what pachets i do need – s.mihai Jun 8 '09 at 4:51

Us psutil module, it provides for memory, cpu, netowrk, etc usages. Visit their project webpage .

share|improve this answer

Lucky ol' you gets to dig around in WMI. Check out the Python module 'wmi' which is about as good as I've seen.

share|improve this answer
i tried that one, i just wasn't able to get that module installed, and i thought there was some other way to achieve this task. – s.mihai Jun 7 '09 at 12:45
What errors did you get? – Alex J Jun 7 '09 at 13:27
i updated the question. – s.mihai Jun 7 '09 at 13:49

You are missing the python win32 extensions which you can find here.

share|improve this answer

This blog entry shows some code:

def get_cpu_load():
    """ Returns a list CPU Loads"""
    result = []
    cmd = "WMIC CPU GET LoadPercentage "
    response = os.popen(cmd + ' 2>&1','r').read().strip().split("\r\n")
    for load in response[1:]:
    return result

if __name__ == '__main__':
    print get_cpu_load()
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.