Using ManagementClass.Getinstances() from IronPython

Posted by Leo Bontemps on Stack Overflow See other posts from Stack Overflow or by Leo Bontemps
Published on 2010-03-21T14:50:40Z Indexed on 2010/03/21 14:51 UTC
Read the original article Hit count: 150

Filed under:
|
|

I have an IronPython script that looks for current running processes using WMI. The code looks like this:

import clr
clr.AddReference('System.Management')
from System.Management import ManagementClass
from System import Array
mc = ManagementClass('Win32_Processes')
procs = mc.GetInstances()

That last line where I call the GetInstances() method raises the following error:

Traceback (most recent call first):
  File "<stdin>", line 1, in <module>
SystemError: Not Found

I am not understanding what's not being found?!? I believe that I may need to pass an instance of ManagementOperationObserver and of EnumerationOptions to GetInstance() however, I don't understand why that is, since the method with the signature Getinstance() is available in ManagementClass.

© Stack Overflow or respective owner

Related posts about python

Related posts about ironpython