Is there any way to programmatically disable and re-enable a NIC, the way it is done when you select Disable in Control Panel/Network Connections?
I've been looking around Win32 and WMI but can't seem to find a way to do it.
-
-
Sven Groot wrote:Is there any way to programmatically disable and re-enable a NIC, the way it is done when you select Disable in Control Panel/Network Connections?
I've been looking around Win32 and WMI but can't seem to find a way to do it.
Look harder
http://www.mcpmag.com/columns/article.asp?EditorialsID=619
-
Sven Groot wrote:Is there any way to programmatically disable and re-enable a NIC, the way it is done when you select Disable in Control Panel/Network Connections?
I've been looking around Win32 and WMI but can't seem to find a way to do it.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_tasks__networking.asp
-
Jan, I think that method will work, thanks for that.
Blowdart, if you read the page, it explicitly says WMI has no method for doing what I want.
-
Sven Groot wrote:Jan, I think that method will work, thanks for that.
Blowdart, if you read the page, it explicitly says WMI has no method for doing what I want.
And then gives you Win32, which you had talked about
I didn't realise you wanted "pure" wmi
-
blowdart wrote:

Sven Groot wrote: Jan, I think that method will work, thanks for that.
Blowdart, if you read the page, it explicitly says WMI has no method for doing what I want.
And then gives you Win32, which you had talked about
I didn't realise you wanted "pure" wmi
Where? All I see is this:...disable or enable a NIC? WMI does not have a provider that supports this operation.
Doesn't seem to mention a non-WMI way of doing it. Anyway Jan's method works so it's sorted now.
EDIT: What they call "disabling a connection" is actually just releasing the DHCP lease which wouldn't be enough in my case. -
Sven, when you finish with it, please share your code with us.
Sheva -
EricZhong wrote:
I need JS or C# or even VB.NET code so I can get through it very easily.
Sheva
-
footballism wrote:Sven, when you finish with it, please share your code with us.
I uploaded it to the Sandbox.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.