What console commands enable or disable Internet access on an external network adapter on a computer with two network adapters?

Сергей Б 0 Reputation points
2024-03-24T07:54:26.4466667+00:00

There is a computer with two network adapters and the Windows 10 operating system. The first adapter is connected by cable to a network that has access to the Internet. The second adapter is connected by cable to a small local network without Internet access.On the first adapter, Internet access is enabled for all members of the small local network.

Problem:

After rebooting this computer, the distribution of the Internet to the small local network stops, although externally in the graphical interface of the adapter the access permission continues to remain enabled (at the same time, access to shared resources on the computer continues to function properly). The user has to manually uncheck the access permission checkbox, click "OK", open the adapter properties again, check the permission box and click "OK" again. I tried to find a Windows service that would be activated by these manipulations, but could not find it. The problem is probably something else.

While searching for information on this problem on the Internet, I found at least two other cases of its existence, but the people who encountered it, like me, did not find a solution.

When the Windows 7 operating system was installed on the same computer and performed the same functions, no problems appeared. Firewall and antivirus do not play a role in this situation (Microsoft and Dr.Web products were tested in enabled and disabled states).

Since using a computer with Windows 10 in this capacity is in itself an extremely rare occurrence, I admit that such a situation has never been considered by specialists at all, so my main question is:

  • Are there console commands that allow you to disable and then restore Internet access in the properties of the first adapter without using the GUI? I've been trying to find these commands online for days without success and would really appreciate some help because the procedure of using the GUI every time I reboot is a pain.
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,346 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Azar 22,860 Reputation points MVP
    2024-03-24T08:39:58.8966667+00:00

    Hey there Сергей Б

    thanks for posting on QandA platform

    To enable or disable Internet access on an external network adapter in Windows 10 using console commands, you can use PowerShell.

    To disable Internet access:

    Disable-NetAdapter -Name "NameOfYourNetworkAdapter

    To enable Internet access:

    Enable-NetAdapter -Name "NameOfYourNetworkAdapter

    You can find the name of your network adapter by running the following command in PowerShell:

    Get-NetAdapter

    Once you have the name of the network adapter, you can use the above commands to disable or enable Internet access on it.

    If this helps kindly accept the answer thanks much.


  2. Wesley Li 8,780 Reputation points
    2024-03-29T10:37:41.5833333+00:00

    Hello,

    Run the command netsh interface show interface to find the name of the adapter you want to operate on.

    Using the adapter name found (let's say "Ethernet"), enter the following command to disable it: netsh interface set interface "Ethernet" admin=disable

    To re-enable the adapter, simply change disable to enable: netsh interface set interface "Ethernet" admin=enable

    You can write these commands to a batch file (.bat) and use them in conjunction with a task scheduler. This way you don't have to adjust that network adapter through the GUI every time.

    0 comments No comments

  3. Сергей Б 0 Reputation points
    2024-03-29T18:09:53.9533333+00:00

    I'm sorry! I'm probably very bad at expressing my thoughts in English! I thank Azar and Wesley Li for trying to help me. But the thing is that I don't need to turn my adapter off/on. This adapter belongs to a network that has the Internet. In its properties (see file Illustration.pdf, top image) on the “Access” tab there is a checkbox with a check mark (see file Illustration.pdf, bottom image). This allows computers on the local network connected to another adapter to receive Internet from the external network. So, after rebooting the computer with two adapters, the checkboxes in the bottom figure are ticked, but there is no Internet distribution to the local network. It is useless to disconnect and re-enable the adapter. I open the properties of the adapter (while I enter the administrator password), go to the "Access" tab and uncheck the checkbox. Then I have to click "OK" to close the adapter properties and give the computer a few seconds to apply the changes. After this, I need to open the properties of the same adapter again (enter the administrator password again), go to the "Access" tab and check the checkbox. Naturally, I click "OK" to close the adapter properties window and apply the changes made. And only after this procedure, access from the local network to the Internet is restored. Simply rebooting the adapter does not bring any results. It is necessary, without disconnecting the adapter, to uncheck the checkbox, apply the changes, and re-check the checkbox. Of course, this procedure is not the most complicated, but I would be very happy to replace it with a script or bat file that the task scheduler would run with elevated rights every time the system boots.Illustration.pdf

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.