How to set to reboot PC automatically upon detecting Wi-Fi dropped?


  1. Posts : 27
    Windows 10 Enterprise x64
       #1

    How to set to reboot PC automatically upon detecting Wi-Fi dropped?


    Hi all, may I know is there any way to set to reboot PC automatically upon detecting Wi-Fi dropped/disconnected?
      My Computer


  2. Posts : 43,212
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    You could schedule a task to do that based on an appropriate event id.

    This discussion mentions some event ids - you can check to see which one might be useful by inspecting your own log.
    wireless networking - How to check the event log (if any) for network failure? - Super User

    However, I have to ask- why would you wish to do this? It seems incredibly drastic, and could result in lost work.
      My Computers


  3. Posts : 17,013
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #3

    I agree with dalchina.

    Perhaps merely disabling then re-enabling the WiFi adapter would achieve what you want.

    Try it manually the next time WiFi is dropped.
    Control panel,
    [View by - Small icons, just so you can see everything],
    Network & sharing centre,
    Change adapter settings,
    Right-click on the WiFi adapter & select Disable,
    Right-click on the WiFi adapter & select Enable

    If that does whatever it is that you want done then you do not need to take the drastic step of restarting the computer.

    You can use a batch file, that needs to be run as Admin, to replace the manual steps above:
    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


    I needed to do this with my last computer but no longer need to do so. I never managed to put together a reliable method detecting when the batch file was needed so just ran it when I could not connect. I hope the link dalchina gave you helps you get further than I did.

    Best of luck,
    Denis
    Last edited by Try3; 08 Jul 2021 at 07:59.
      My Computer


  4. Posts : 17,013
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #4

    I have studied the link dalchina gave you. About the helpful post starting "The eventlog filter would be" by SilverbackNet dated 14th August 2020:-

    1 That thread is about detecting loss of the internet connection which is not quite the same as your question here.

    2 The poster meant to write Task scheduler rather than Task manager. If you define an Event viewer, Custom view then you can use it to trigger a Task scheduler task.

    3 I have attached a Custom view definition for detecting loss of an internet connection. InternetConnectionLost.zip You can import it by clicking on the link on the right-hand side of Event viewer Import Custom view … Importing this Custom view will do no harm even if you decide it is not quite what you were after.

    4 If that Custom view was what you were after [but I don't think so from what you've written] then you would then be able to select it on the left-hand side of Event viewer, Custom views and click on [on the right-hand side] Attach task to this Custom view... and it would step you through defining a TS task. I would suggest testing the results first by just making a simple task such as running Notepad [C:\Windows\System32\notepad.exe] and only bothering to refine the task to do what you want when you have decided that the Event viewer, Custom view is detecting when you want it to. Please note again that that SuperUser thread is not addressing quite the same question as the one you have asked here.

    Denis
      My Computer


  5. Posts : 27
    Windows 10 Enterprise x64
    Thread Starter
       #5

    Thanks all for help.

    Is this bat work for me?

    ping 192.168.1.1
    IF ERRORLEVEL 1 SHUTDOWN -R -T 00
      My Computer


  6. Posts : 17,013
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #6

    Are you certain that you want to shutdown & restart whenever the computer fails to detect another computer that is on that specific IP address?
    If so then your commands will achieve what you want.

    I remain concerned that my advice might be inappropriate because I remain concerned that I do not understand why you want to take this drastic action.

    Denis
      My Computer


  7. Posts : 43,212
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #7

    You'd also have to run that as a repeated test.

    You would be wiser to look at ways to reconnect your Wifi, or, far better, find out why it's dropping. For example, is the signal weak? Consider extenders and placement - proximity.

    Consider using a different Wifi band- perhaps there's a conflict- interference.

    This freeware program shows you the bands and signals near you - the one in use will hopefully be the strongest.
    How to set to reboot PC automatically upon detecting Wi-Fi dropped?-1.jpg

    This is more helpful:
    How to set to reboot PC automatically upon detecting Wi-Fi dropped?-1.jpg

    - and allow you to monitor the signal strength over time graphically:
    How to set to reboot PC automatically upon detecting Wi-Fi dropped?-1.jpg

    Are you certain the connection is dropping because fo Wifi problems- or because of your ISP connection being erratic?

    Do other devices experience the same thing?
      My Computers


 

  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 12:12.
Find Us




Windows 10 Forums