O
O
oventarb2015-03-20 09:51:58
Computer networks
oventarb, 2015-03-20 09:51:58

Where can I get the automatic on / off program and network adapter settings?

Where can I get a ready-made solution (or how to write my own in CMD/PowerShell/Java/Python at minimal cost)
so that it does:
A specific IP was constantly pinged.
As soon as the ping disappears: turn off the adapter, turn on the adapter, set the IP on the adapter statically.
I know the commands netsh interface ip set address,
netsh interface set interface.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
L
ldv, 2015-03-20
@oventarb

@echo off
:loop
ping -n 1 ya.ru || (
netsh interface set interface "Ethernet" admin=DISABLED
netsh interface set interface "Ethernet" admin=ENABLED
netsh interface ipv4 set address "Ethernet" static 10.0.0.1 255.255.255.0 10.0.0.2
exit
)
timeout 1
goto loop

V
Valentin, 2015-03-20
@vvpoloskin

Usually system scripts are used for this. On CMD/PS this can be done quickly.

V
Vitaly Pukhov, 2015-03-20
@Neuroware

A strange task was set, in connection with which this was needed?

A
Andrey Ermachenok, 2015-03-20
@eapeap

At the price of PCI setevukha 300 rubles - to start all this trouble???!!!

A
athacker, 2015-03-20
@athacker

There is an example script in Powershell/CMD: blogs.technet.com/b/heyscriptingguy/archive/2014/0...

O
oventarb, 2015-03-20
@oventarb

I completely forgot about the possibility of batch files if errorlevel.
The topic can be closed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question