Search code examples
winapinetwork-programmingwindows-xptcp

"Repair" network connections programmatically/from command line


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.


Solution

  • Thanks, guys, I think I figured it out. The steps in the MS KB article posted by lpfavreau are almost complete. That's what I tried and it didn't work. However, if I do ipconfig /release first then it seems to work. I suspect that the "Repair" button does that without it being explicitly documented. For my particular case I also had to clear the routes ("route -f"). So, the commands I ended up running in the end are:

    route -f
    ipconfig /release
    ipconfig /renew
    arp -d *
    nbtstat -R
    nbtstat -RR
    ipconfig /flushdns
    ipconfig /registerdns
    

    I also found some C code to call the actual "Repair Connections" functionality, though I haven't tested it - see last post here.