Alex Rivera | Logout

"Repair" network connections programmatically/from command line

Asked 2008-12-20T06:13:56.213
11

Does anyone know exactly what Windows XP does when you click "Repair" on a network connection? I'd like to do the same programmatically or from a command line.

I did a Google search and found this article, which has a good explanation, but I don't think it's complete. I can reliably reproduce a condition where I lose network connectivity and clicking the Repair button fixes the problem, but running the commands in that article does not.

Edit
Report

3 Answers

8

Seems there's a few more things it does:

  • Dynamic Host Configuration Protocol (DHCP) lease is renewed: ipconfig /renew
  • Address Resolution Protocol (ARP) cache is flushed: arp -d
  • Reload of the NetBIOS name cache: nbtstat -R
  • NetBIOS name update is sent: nbtstat -RR
  • Domain Name System (DNS) cache is flushed: ipconfig /flushdns
  • DNS name registration: ipconfig /registerdns

One thing though, if you have a connection that breaks so often you need to programmatically repair your network, this might not be the solution you are looking for.

answered 2008-12-20T06:29:57.680
1

I experience wifi connection, dropped from time to time on my XP box, without any apparent reason, and the only way to fix this is to right click on the wifi connection icon on systray and repair.

To get this done from command line, I follow the steps on this article and it works for me: http://wlanbook.com/enable-disable-wireless-card-command-line/

answered 2012-08-07T15:28:15.343
0

It's just done with 1 api call !

see on Win32 api forum news://comp.os.ms-windows.programmer.win32 where the code had been given (C)

answered 2008-12-20T11:46:00.160

Your Answer