The bottom line is connecting the phone on the android as a USB modem, creating a new network in the adapter settings, how to make this new network immediately “share” the Internet to my local area network (LAN) Ethernet (shorter router), so as not constantly climb in the properties and put a daw? Can use the script on PowerShell or bat. Is it possible to use a PowerShell script or bat to do this, is the MAC device known, or is it easy to add it to the exceptions?

  • What properties do you climb and what do you put on? If the event is generated when you connect the phone and create a new network, then you can create a task to be performed on this event. And what to write down there will depend on your answer to my question. :) - Sergey Nudnov

1 answer 1

Without claiming the correct answer, just leave it as a note, because in the comment the text does not fit.

Personally, I had to send traffic to a specific host via a modem. I did this by setting the trigger from the NetworkProfile source to the event number 10,000. I give as an example the part of the code where Id of the network connection is searched for a USB modem that works as an RNDIS interface. The wmic utility is used and the value found is written to idx . And then you can already do what you want.

@rem ============ Variable description ============== @set mdm=RNDIS @rem ============ Script ======================= @for /f "tokens=1,2 delims== usebackq" %%i in (`@wmic nic where NetConnectionID^='%mdm%' get Index /value ^|@find "Index"`) do @set idx=%%j @if "%idx%" equ "" exit /b 1 

But I think the Powershell solution is the best solution. Batch is already outdated, although they can autoconfigure the network interface.