Admin CMD Prompt - Clean & Reset Network

Page 2 of 4 FirstFirst 1234 LastLast

  1. Posts : 1,203
    11 Home
       #11

    IMO resetting Winsock with netsh winsock reset (and resetting the TCP/IP settings with netsh int ip reset after that, if needed...) could be considered to be above your description of "low-level".
    How and Why to Use the Netsh Winsock Reset Command (In 2021)

    The order in which to execute the commands has more to do with how it also is possible to try and find clues to what actually was causing the problem. For example, the logical thing to do before ipconfig /release would be something like ipconfig /all >ip-settings-before-release.txt and after ipconfig /renew would be something like ipconfig /all >ip-settings-after-renew.txt to be able to catch a glimpse of what might be going on in that regard. Similarly, you might want to add arp -a >arp-table-before.txt before and arp -a >arp-table-after.txt after arp -d * also in addition to that, just like you could also decide to add ipconfig /displaydns >dns-resolver-cache-before.txt before and ipconfig /displaydns >dns-resolver-cache-after.txt after ipconfig /flushdns and catch more glimpses.
      My Computers


  2. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #12

    Hello @hdmi, thanks for the detailed post, it is very much appreciated.

    hdmi said:
    IMO resetting Winsock with netsh winsock reset (and resetting the TCP/IP settings with netsh int ip reset after that, if needed...) could be considered to be above your description of "low-level".

    How and Why to Use the Netsh Winsock Reset Command (In 2021)

    The order in which to execute the commands has more to do with how it also is possible to try and find clues to what actually was causing the problem. For example, the logical thing to do before ipconfig /release would be something like ipconfig /all >ip-settings-before-release.txt and after ipconfig /renew would be something like ipconfig /all >ip-settings-after-renew.txt to be able to catch a glimpse of what might be going on in that regard. Similarly, you might want to add arp -a >arp-table-before.txt before and arp -a >arp-table-after.txt after arp -d * also in addition to that, just like you could also decide to add ipconfig /displaydns >dns-resolver-cache-before.txt before and ipconfig /displaydns >dns-resolver-cache-after.txt after ipconfig /flushdns and catch more glimpses.

    I do have a Script that I wrote that collects Network information using some 30+ Commands, but the Script is purely for informational purposes [ Link in my signature ].

    From an analysis aspect, your method above is indeed an excellent way to narrow down and capture the possible cause[s] of an error, if and when they occur.

    I do NOT have a Network problem. The reason the Commands I posted are very few is because the MAIN purpose of my request is to incorporate a Low-Level Network Cleanup as part of my weekly [ or whenever I want to run it ] Cleanup Script.

    I might actually leave out the netsh winsock reset Command.

    Thanks again.
    Last edited by Paul Black; 18 Jan 2022 at 19:59.
      My Computer


  3. Posts : 1,203
    11 Home
       #13

    If you do not have a network problem, then running the batch script does nothing AFAIK except it causes a temporary decline in network performance, i.e., it creates a network problem where there isn't one. (Even, if the magnitude of the network problem that it creates may in fact turn out not to be higher than minuscule.)
      My Computers


  4. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #14

    Hello @hdmi,

    I might change the focus of this thread to creating a Script [ which is on my to-do list ] for Network problems using the format that you posted in your previous Post. Something like this for example . . .

    Code:
    
    ipconfig /all         > ip-settings-before-release.txt
    ipconfig /release
    ipconfig /renew
    ipconfig /all         > ip-settings-after-renew.txt
    arp -a                > arp-table-before.txt
    arp -d *
    arp -a                > arp-table-after.txt
    nbtstat -R
    nbtstat -RR
    ipconfig /displaydns  > dns-resolver-cache-before.txt
    ipconfig /flushdns
    ipconfig /displaydns  > dns-resolver-cache-after.txt
    ipconfig /registerdns

    The files can then be easily compared by using the Compare Plugin in Notepad++, which I find invaluable.

    You mentioned previously about using netsh winsock reset and netsh int ip reset. Do you think that they wold be a good addition to the above, and if so, would you place them as the last two entries in the Script above?

    Thanks.
      My Computer


  5. Posts : 1,203
    11 Home
       #15

    Paul Black said:
    You mentioned previously about using netsh winsock reset and netsh int ip reset. Do you think that they wold be a good addition to the above, and if so, would you place them as the last two entries in the Script above?
    Resetting Winsock not only needs you to reboot, on modern versions of Windows there are no LSPs and corruption of Winsock typically no longer occurs as often as it once used to, in fact on Windows 10/11 it should normally happen only (very) rarely. I can't even remember when was the last time I had to reset anything in Windows that was some way related to Ethernet or WiFi. So, I wouldn't include either netsh winsock reset or netsh int ip reset in the script.

    Putting ipconfig /all before and after (similar to before-release and after-renew) netsh int ip reset would also be useful. But I don't think that netsh int ip reset belongs in the same script as the one from the Windowsclub article either.
    A suggestion would be to add a pause command so that you can still choose between either letting the script continue or closing the command window. Then when you choose to let it continue, it runs a separate script with the necessary commands to open the before + after (side by side in the plugin for each pair), or something like that.
      My Computers


  6. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #16

    Hello @hdmi,

    hdmi said:
    A suggestion would be to add a pause command so that you can still choose between either letting the script continue or closing the command window. Then when you choose to let it continue, it runs a separate script with the necessary commands to open the before + after (side by side in the plugin for each pair), or something like that.

    That can be simply achieved by using . . .

    Code:
    
    start Notepad++.exe "%UserProfile%\Desktop\ip-settings-before-release.txt"
    start Notepad++.exe "%UserProfile%\Desktop\ip-settings-after-renew.txt"

    Code:
    
    @echo off
    
    ipconfig /all     > ip-settings-before-release.txt
    ipconfig /release 
    ipconfig /renew
    ipconfig /all     > ip-settings-after-renew.txt
    start Notepad++.exe "%UserProfile%\Desktop\ip-settings-before-release.txt"
    start Notepad++.exe "%UserProfile%\Desktop\ip-settings-after-renew.txt"
    echo Press ANY key to Continue . . . & pause >nul & taskkill /IM Notepad++.exe /f >nul 2>&1
    
    arp -a   > arp-table-before.txt
    arp -d *
    arp -a   > arp-table-after.txt
    start Notepad++.exe "%UserProfile%\Desktop\arp-table-before.txt"
    start Notepad++.exe "%UserProfile%\Desktop\arp-table-after.txt"
    echo Press ANY key to Continue . . . & pause >nul & taskkill /IM Notepad++.exe /f >nul 2>&1
    
    nbtstat -R
    nbtstat -RR
    ipconfig /displaydns > dns-resolver-cache-before.txt
    ipconfig /flushdns
    ipconfig /displaydns > dns-resolver-cache-after.txt
    start Notepad++.exe "%UserProfile%\Desktop\dns-resolver-cache-before.txt"
    start Notepad++.exe "%UserProfile%\Desktop\dns-resolver-cache-after.txt"
    echo Press ANY key to Continue . . . & pause >nul & taskkill /IM Notepad++.exe /f >nul 2>&1
    
    ipconfig /registerdns
    echo Press ANY key to EXIT . . . & pause >nul & Exit

    Last edited by Paul Black; 19 Jan 2022 at 16:32.
      My Computer


  7. Posts : 5,048
    Windows 10/11 Pro x64, Various Linux Builds, Networking, Storage, Cybersecurity Specialty.
       #17

    @Paul Black -

    A script is just fine, but the network reset process is actually quite simple and straightforward.

      My Computer


  8. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #18

    Hello @Compumind,

    Compumind said:
    . . . the network reset process is actually quite simple and straightforward.
    Are you talking about a Tutorial, through Settings, or something else? Perhaps you could elaborate please.
      My Computer


  9. Posts : 5,048
    Windows 10/11 Pro x64, Various Linux Builds, Networking, Storage, Cybersecurity Specialty.
       #19

    Paul Black said:
    Hello @Compumind, Are you talking about a Tutorial or something else? Perhaps you could elaborate please.
    Unless I'm truly missing something here, I think that your initial procedure (with my input above) is the way to go. Small batch script will do.

    Simple as that.

      My Computer


  10. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
    Thread Starter
       #20

    Compumind said:
    I think that your initial procedure (with my input above) is the way to go.
    Ah, OK, thanks @Compumind.
    Last edited by Paul Black; 19 Jan 2022 at 17:49.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:39.
Find Us




Windows 10 Forums