How to automate resetting the adapter?

Page 2 of 5 FirstFirst 1234 ... LastLast

  1. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #11

    Yes, you need to run the batch file as Admin - netsh commands need Admin permissions.

    If you want, in the future, to lengthen the period for which you are prepared to tolerate a lost internet connection before resetting the adapter, you could change the line
    Code:
    If %TestCounter% LSS 7 GoTo DoTheTest
    to a higher number. Each test takes about 1.4-1.6 secs so, for example, if you could tolerate up to about a minute of lost connections you could increase the number to about 40. I tested the batch file a dozen or so times to get my 1.4-1.6 secs estimate and there might well be occasions when it takes considerably longer / less time.

    Denis
      My Computer


  2. Posts : 12
    Windows 10 64
    Thread Starter
       #12

    Thanks Dennis!
      My Computer


  3. Posts : 2
    Windows 10 Pro x64
       #13

    Thanks, Try3 for your detailed and patient response. I have the same problems and had thought of creating a Task. Unfortunately I had never written a Task before so I googled it to get some examples. Lo and behold this thread came up which covered exactly the Task I needed to create.
      My Computer


  4. Posts : 17
    Windows 10
       #14

    Try3 said:
    Yes, you need to run the batch file as Admin - netsh commands need Admin permissions.

    If you want, in the future, to lengthen the period for which you are prepared to tolerate a lost internet connection before resetting the adapter, you could change the line
    Code:
    If %TestCounter% LSS 7 GoTo DoTheTest
    to a higher number. Each test takes about 1.4-1.6 secs so, for example, if you could tolerate up to about a minute of lost connections you could increase the number to about 40. I tested the batch file a dozen or so times to get my 1.4-1.6 secs estimate and there might well be occasions when it takes considerably longer / less time.

    Denis
    Thanks a lot for putting the script out there!

    I was wondering however,

    Since 7 is just a number of tests
    If %TestCounter% LSS 7 GoTo DoTheTest

    Wouldn't one need to increase the 1 in
    TimeOut /T 1 /NoBreak

    In order for the script to wait longer?
      My Computer


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

    Dave,

    You seem to be asking how to lengthen the time between tests. The OP was asking, as I understood it at the time, how to increase the period that he would tolerate a dropped connection for.

    If you want to increase the time between tests then you can use TimeOut.
    But that would not be quite the same thing because a dropped connection just before your next re-test would be treated in the same way as a dropped connection immedately after the previous test.
    Only continual testing supports deciding how long to tolerate a dropped connection for. And that was what the OP wanted to specify.

    Denis
      My Computer


  6. Posts : 17
    Windows 10
       #16

    Try3 said:
    Dave,

    You seem to be asking how to lengthen the time between tests. The OP was asking, as I understood it at the time, how to increase the period that he would tolerate a dropped connection for.

    If you want to increase the time between tests then you can use TimeOut.
    But that would not be quite the same thing because a dropped connection just before your next re-test would be treated in the same way as a dropped connection immedately after the previous test.
    Only continual testing supports deciding how long to tolerate a dropped connection for. And that was what the OP wanted to specify.

    Denis
    Gotcha, thanks 👍
      My Computer


  7. Posts : 17
    Windows 10
       #17

    @Try3

    I've recently tried using the script, but have found it, seemingly not quite working, a 100%...

    Am I doing something wrong perhaps?

    What I get is the following:

    How to automate resetting the adapter?-2020-07-24-23_29_24-administrator_-c__windows_system32_cmd.exe.jpg
      My Computer


  8. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #18

    Dave,

    The part in red is the response you should get if you are not connected to the internet.

    I cannot see what problem you are trying to show me.

    In your reply, please also confirm the name of your wifi adapter as shown in Network & sharing centre, Change adapter settings.

    Denis
      My Computer


  9. Posts : 17
    Windows 10
       #19

    Try3 said:
    Dave,

    The part in red is the response you should get if you are not connected to the internet.

    I cannot see what problem you are trying to show me.

    In your reply, please also confirm the name of your wifi adapter as shown in Network & sharing centre, Change adapter settings.

    Denis
    Thanks for clarifying! When the connection was lost and I run the script, it didn't seem to quite bring it back again, but in future I'll need to keep it open for much longer, in order to fully confirm this

    How to automate resetting the adapter?-2020-07-26_21-15-26.jpg
      My Computer


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

    zhaider said:
    Also, I need to run it as Admin, right?
    Add the following line at the top. It will be run with administrative privileges automatically.

    (Net session >nul 2>&1)||(PowerShell start """%~0""" -verb RunAs & Exit /B)
      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 13:46.
Find Us




Windows 10 Forums