Fixing deeply screwed networking in Windows

I've been in this situation a couple of times before, but I've never been able to fix it ... not until today. Let's assume that somehow your network setup in Windows gets screwed up. Ie. you've no network connection, the network adapter in Device Manager has a small yellow exclamation mark meaning it has some obscure problem that prevents it from normal functioning. And of course re-installing the adapter won't help because you get an obscure "error occurred during the installation of the device" error message (maybe you even get a "The system cannot find the file specified." message along too) ... or even better, you cannot uninstall the adapter at all because you get a "Failed to uninstall the device. The device may be required to boot up the computer." error message. All seems to be lost.

But it's not! Smile Of course I suppose here that previously you already had a working network connection, ie. you've a working device driver for your network card, etc. It's just that something screwed up the inner network configuration in Windows. Eg. I had this with Nortel VPN Clients (various versions), usually installing or uninstalling them can get you into this kind of mess. Or in another case I got here during uninstallation of some personal firewall product. So usually a piece of badly written software that hacks it's way through Windows networking at a very deep level.

I had to reinstall various Windows PCs at least 3-4 times in my life til now due to such problems. But a few minutes ago I finally stumbled on this experts-exchange.com question where a poster named slsmith provided the working solution to completely reset the network configuration of Windows (I tested it with XP, but I assume the same would work for most other Windows versions too). If you're not registered there, you can take a look at the Google cached version of the page which contains the answers too.

The solution is documented in the KB937056 Microsoft Knowledge Base article. The problem with this article is it's title and description (ie. the "symptoms" section). The described method is a generic way to reset the network configuration in Windows, however the title+description is about a very specific problem. No wonder I did not find it before. The article says it applies to Windows 2000 and 2003 Server, but I successfully used it on a Windows XP SP3. Probably it works for Vista and Windows 7 too (but I'd test this in a virtual machine before tried it in a "live" environment).

I'll copy the instructions here, because I'm afraid that it might disappear from the web and it's too important/useful to just vanish.

"Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

To resolve this problem, follow these steps:
  1. Download and then install the latest version of the network adapter driver on the computer.
  2. Click Start, click Run, type regedit, and then click OK.
  3. Locate and then delete the following registry subkey:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Network\Config
  4. If your server is a domain controller, go to step 5. (This includes servers that are running Windows Small Business Server 2003.) If your server is not a domain controller, delete the following registry subkeys:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Adapters\ {GUID}
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID}
  5. Click Start, click Run, type sysdm.cpl, and then click OK.
  6. In the Systems Properties dialog box, click the Hardware tab, and then click Device Manager.
  7. In Device Manager, expand Network adapters, right-click the network adapter that you want, and then click Uninstall.
  8. Restart the computer.
After the computer restarts, the operating system automatically detects the network adapter. If the network adapter is not detected, you may have to manually reinstall the network adapter drivers."