On 10/06/2010 07:51, pacopyc pacopyc wrote:
Excuse me, I'd like to disable network interface of a remote host. I'm
thinking to use Win32_NetworkAdapter.

Isn't that rather like sawing off the branch you're sitting on?

What do you think? How can I do? Is it possible disable network interface?
Can you help me?

I found in Internet this code:

import wmi;
c = wmi.WMI()
o = c.query("select * from Win32_NetworkAdapter where
NetConnectionID='wifi'")[0]
o.EnableDevice(1)

Well, the Win32_NetworkAdapter class doesn't have an EnableDevice method
AFAICS, although it has Enable and Disable methods from Vista/2k8 onwards.
The other obvious place to look is Win32_NetworkAdapterConfiguration. Although that doesn't have a straightforward Enable/Disable, you might achieve the same effect by turning off DHCP and giving it a NULL static address. Or something.

TJG
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to