How to reset your Network Adapter (NIC/LAN)

orange_livebox

Ever since I got my Orange Livebox, I always had a problem connecting to the Internet each time I started my PC.

The problem was that the network adapter, Realtek RTL8139/810x Family Fast Ethernet NIC for me, did connect to the Livebox, but it didn’t detect the Internet connection.

Because the problem occurred on both XP & Vista, I knew it was my onboard network adapter that was faulty. & while googling for it, I found it was a recurrent problem with many NICs.


XP_Repair_Network_Connection_2
XP_Repair_Network_Connection

The only solution, on XP was going into the network properties & repairing the connection.

Vista_Network&Sharing_center

While on Vista, that meant going into Network and Sharing Center.

Vista_Local_Area_Connection_Status

Then the connection status… click on Diagnose.

Vista_Diagnose_LAN

… to which the only solution that worked was resetting the network adapter.

Vista_Windows_Network_Diagnostics

But as you’ve noticed, it’s a real pain having to do that each time I start my PC.. :(
What I needed was a script that auto-resets the network adapter every time I start my PC…. & here it is. I’ll start with the easiest.

The Network Shell

Run Command Prompt (cmd) & type the following to enable/disable the network adapter.
netsh interface set interface name="Local Area Connection" admin=DISABLED
netsh interface set interface name="Local Area Connection" admin=ENABLED

Vista_Netsh

The network connection named “Local Area Connection” will be reset. In the same way, if you’ve got your connection named “Linksys WRT” or “MyLanNetwork" you’ll need to replace it there & it’ll work.

& if you want to run it on startup, copy the above in a txt & save it as *.bat  & put a shortcut to that file on your startup folder (Start Menu –> Startup).
More info about Netsh.exe on Microsoft here & here.

DevCon

The alternative to the above is the very powerful DevCon CLI version of Device Manager. The procedure is lengthier since you’ll need to download DevCon first – download here & then copy DevCon.exe to C:\Windows\System32 so that you can access it from cmd.
Next is to fire up cmd & then type the following:
devcon hwdis =net

Vista_Devcon

This will display all your network devices & their different Hardware IDs & Compatible Vendor IDs.
For me, the first one (Realtek) is the network adapter I’m using. I note down one of its IDs & now to enable/disable my network adapter I just type the following:
devcon disable PCI\VEN_10EC
devcon enable PCI\VEN_10EC

Vista_Devcon_2

& this did the job! You don’t really need to use the longest ID, the shortest will do. Obviously if you got a different network adapter, the ID won’t be the same – just replace VEN_10EC by your ID. & if you got multiple network adapters of the same make, use the Hardware IDs, since they’ll most probably have the same Vendor IDs.
Similarly, just copy the above 2 commands to a *.bat & copy it to the Startup folder.

There’s a third way of doing it with the uber-powerful Windows PowerShell – but why bother to go such lengths, if you already have two simple commands! For now enjoy auto-resetting your network adapter! :)

Update:
I’ve encountered a slight snag while using the above 2 scripts on startup… my PC boots up too fast! & it boots faster than the Orange Livebox, so actually it resets the network adapter even before the connection is made – meaning the hack is useless. But I’ve got the solution.
So if you have a very fast PC, you’ll need to download Startup Delayer. Remove the bat shortcut from the Startup folder & then configure Startup Delayer to run the bat file 30-60s after startup. That’s it! :P

PS. I’ve been blogshoted by Kurt Avish - CarrotMadMan6 On Blogshot With Kurt!!