Answer the question
In order to leave comments, you need to log in
How to make an ethernet network connection automatically restart when there is no internet?
Greetings. It's not the first day I've been fighting with automation, the task is to restart the Internet adapter over the wire.
I tried to release .bat through a ping check and a command to turn off and turn on the adapter, but he carried out a ping check until I pulled out the wire myself, or changed the provider's poppy to create a shutdown situation. the batnik was closed. although he had to restart the adapter until the Internet turned on, that is, check the ping and until he responded to restart the adapter. Knowledgeable people, help solve the problem.
@echo off
:LOOP
ping 8.8.8.8 -n 2
if errorlevel 1 (
echo %Errorlevel%
echo %date% %time% >> C:\log.txt
netsh interface set interface name="Ethernet" DISABLE
netsh interface set interface name="Ethernet" ENABLE
exit
) ELSE (
echo
)
timeout /T 30
goto
LOOP
Answer the question
In order to leave comments, you need to log in
Create a task in the Task Scheduler that will run at regular intervals.
For example, once every five minutes, or once every half an hour.
Call the batch file, it pings the resource, and if there is no ping, it reboots the adapter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question