Resetting Network Adapter

Page 1 of 2 12 LastLast

  1. Posts : 66
    Windows 10
       #1

    Resetting Network Adapter


    While I have read several suggestions for resetting the network adapter, they all involve rebooting the PC. I am wondering why the Windows Network and Internet troubleshooter doesn't reboot after resetting the adapter? Whatever it does appears (mostly) to solve my network connection issues and a solution that doean't involve rebooting would be an improvement.
      My Computer


  2. Posts : 7,607
    Windows 10 Home 20H2
       #2

    Run the following via an elevated Command Prompt. Then "Network Connections" will be restarted without a reboot.

    net stop "Netman" & net start "Netman"
      My Computer


  3. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #3

    Do you mean turning the adapter off then on again? I need to do this on one computer and I use a batch file. It needs to be run as Admin but no reboot is required, it just takes effect immediately.

    DisableEnableWiFiCard.bat
    Code:
    netsh interface set interface "Wi-Fi" disabled
    netsh interface set interface "Wi-Fi" enabled
    - The name of my adapter is "Wi-Fi" so you just need to replace that with the name of yours [as shown in the Control Panel, Network and Sharing Center, Change adapter settings screen].

    Denis
      My Computer


  4. Posts : 7,607
    Windows 10 Home 20H2
       #4

    To find the adapter's name (the interface name), run the following command:

    Netsh interface show interface
      My Computer


  5. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #5

    Matthew,

    Yes. My full batch file retrieves the adapter name then uses it but I didn't think the OP would want to get into non-essential complexities.

    DisableEnableWiFiCard.bat
    Code:
    :: The WiFi must be turned on first
    prompt $g
    Set /a Found=0
    set FindString=Name
    Set UseExpresssion=netsh wlan show interfaces 
    for /F "tokens=*" %%X IN ('%UseExpresssion%  ^|   find /i "%FindString%"') do Call :Interfaces "%%X"
    GoTo EndGetWiFi
    :Interfaces
    Set ThisLine=%~1
    Set AdapterName=%ThisLine:*: =%
    GoTo :EOF
    :EndGetWiFi
    :: Do the disabling-enabling
    netsh interface set interface "%AdapterName%" disabled
    netsh interface set interface "%AdapterName%" enabled
    ::Pause to check outcome

    Denis
      My Computer


  6. Posts : 7,607
    Windows 10 Home 20H2
       #6

    @Try3, I have no WiFi adapter, so I can't try your script, which seems much more complex than the following one, which will restart my LAN adapter.
    Code:
    For /F "tokens=1,2,3* delims= " %%G in ('netsh interface show interface') DO (
    netsh interface set interface name="%%J" admin="disabled" 
    netsh interface set interface name="%%J" admin="enabled")
      My Computer


  7. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #7

    If you compare it to the script I gave you for finding a user's Desktop path, you will see that it is the same structure. Incorrect - that came from a different template.

    I use this structure for every tool that needs to set a variable value from the response to an expression.

    Whereas you have compressed your complexity within your treatment of the tokens argument, I have left mine spread out for the sake of conformity with other uses of the same basic code block. Neither script is any more complex then the other.

    I have many other script segments that I use as components of other scripts, as subroutines within them or as separate script files. I do not want to gain some insignificant & disputable degree of efficiency in one usage at the expense of complicating script maintenance in the future. Debugging your script requires your brain power. Debugging mine requires only my eyeballs because I have at least a dozen others to compare it to.

    Denis
    Last edited by Try3; 28 Feb 2020 at 15:15.
      My Computer


  8. Posts : 66
    Windows 10
    Thread Starter
       #8

    Thanks Guys
      My Computer


  9. Posts : 7,607
    Windows 10 Home 20H2
       #9

    @Try3, I have replaced netsh wlan show interfaces with netsh interface show interface in your code, and it cannot retrieve my LAN adapter's name. What's wrong?
      My Computer


  10. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #10

    What changes did you make to FindString & the processing of the response?

    I really do not see netsh interface show interface being amenable to adapter name extraction unless there was only one enabled network adapter in the computer. Having both an ethernet adapter & a WiFi adapter is commonplace.
    Similarly, netsh wlan show interfaces would fail to find the correct data if there was more than one enabled WiFi adapter. But that seems to me to be a suitable working assumption.

    Denis
    Last edited by Try3; 28 Feb 2020 at 04:30.
      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 05:49.
Find Us




Windows 10 Forums