#571 Calling Win32_NetworkAdapterConfiguration routines fails

com (105)

I am trying to set the ip address of a network interface using win32com module and unable to do so. I have tried searching a lot but wasn't able to get a answer for the issue. Here is the code I am running : import win32com.client

obj = win32com.client.Dispatch("WbemScripting.SWbemLocator")

wmobj = obj.ConnectServer("localhost","root\cimv2")

nobj = wmobj.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")

for n in nobj:

print n.Caption


When I run this code it errors out with following error :

Traceback (most recent call last): File "", line 3, in n.SetMTU('9000') File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 505, in getattr ret = self.oleobj.Invoke(retEntry.dispid,0,invoke_type,1) com_error: (-2147352567, 'Exception occurred.', (0, u'SWbemObjectEx', u'Invalid method ', None, 0, -2147217362), None)

I did some more debugging and found that I can access any variables of Win32Networking class but whenever I try to call any routine of the class it returns me this same error.


  • Mark Hammond

    Mark Hammond - 2011-11-28

    Thanks for your report, but this tracker is for reporting bugs in pywin32 rather than a support forum.

    Please email support requests to the python-win32 mailing list where many more people will see your request and be able to help. You need to be subscribed to the list before you can post to it - see http://mail.python.org/mailman/listinfo/python-win32 for subscription options.

  • Mark Hammond

    Mark Hammond - 2011-11-28
    • status: open --> closed-works-for-me

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks