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.
Can't be done. Once the interface is disabled Windows cannot see when a cable has been plugged in. It needs the interface enabled in order to talk to it and get the information about whether or not it has network connectivity. Your best et is to see if you can finnd a way to leave the interface enabled but not available at the application level, then enable that level when there is connectivity. This is of course a programming issue and not appropriate for SF.