Hello,
I have some issues with a computer which for some for me unknown reason goes out of network. Until I find a problem and solution I would like to have a script that will:
- Ping xxx.xxx.xxx.xxx
- If get response does nothing
- If don't get a response have to check again within 180 sec and if don't get response disable NIC and enable it again
script has to do that process every 15 minutes (if that is not too much of repeating). I know that I can put a script into task scheduler for this.
ipconfig:
https://freeimage.host/i/HUlLeWP
thanks for help in advance
BM
Ping if unsuccessful disable and enable NIC
Moderator: DosItHelp
Re: Ping if unsuccessful disable and enable NIC
Here's what I came up with, it's all one line:
To get the name of your network adapter, you can run "netsh interface show interface".
This needs to be run as admin obviously.
Code: Select all
ping 192.0.2.1 && echo all good || (timeout 180 & ping 192.0.2.1 || (netsh interface set interface "Adapter" disable && netsh interface set interface "Adapter" enable))
This needs to be run as admin obviously.