Disable (or switch off) a network interface on windows but keep the "plug and play"

Posted by Leandro on Server Fault See other posts from Server Fault or by Leandro
Published on 2012-05-30T00:48:54Z Indexed on 2012/06/06 4:42 UTC
Read the original article Hit count: 467

Filed under:
|
|
|

I'm looking for a good workaround to do this on Windows 7 and Windows XP:

  • Disable or make ineffective the network interface (ETH, WIFI, any NIC).
  • If the user connect his ETH cable, the network interface enable again.

Important Notes to take care:

  • I'm working with wmic on Win7 (through the command line)
  • I'm working with devcon on WinXP (through the command line)
  • I'm specifically working with the .NET Framework 2.0 on C# but this is just for informational purposes.
  • I know that an event won't help me to detect it (if there is a way or workaround to do this I don't know it).

The real problem is that when I disable the NIC, I can't know if the user connects his cable or has a wired network. This is why I am looking for a workaround.

I'll treat suggestions as answers if no direct answer exists. I'll provide any extra detail necessary.

© Server Fault or respective owner

Related posts about networking

Related posts about windows-7