Question

I am trying to enable/disable network binding interfaces in Windows using Python. See the picture below:

Netwok binding interfaces dialog box

I've understand that I have to utilize INetCfg COM interfaces for this. And I believe comtypes is the proper way to do this in Python. But still, I am pretty much new to comtypes.

The following page is how to disable/enable IPv6 in C. Does that C version can be easily converted to python using Comtypes?

Was it helpful?

Solution

Quick update : I have solved this. You will have to:

  1. Generate TLB for INetCfg interface
  2. Import it into Python using Comtypes
  3. Create a COM object of INetCg instance
  4. Acquire write lock
  5. FindComponent for a given NIC
  6. Enumarate protocol for that given NIC
  7. Bind/Unbind protocol from given NIC
  8. Apply changes
  9. ReleaseLock

I will elaborate it as soon as I have time for this You will have to get acquainted of comtypes to easily implement this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top