Very often, when working on a remote site, you must distort the network cable or disconnect and enable the network adapter. But since we cannot do this physically, we have to ask someone to do it or to excel in such ways. In Linux, this happens easily, via ssh we drive in ifdown eth0 & ifup eth0 and all the rules. In Windows, you have to do the following to restart the network adapter.
1. Disable or Enable the Network Adapter in Network Connections
In the search bar or in the execute menu, type
control.exe / name Microsoft.NetworkAndSharingCenter and press the Enter key (or go to the Start menu ⇨ Settings ⇨ Network and Internet ⇨ Status ⇨ Adapter settings”).
On the left side, click on “Change adapter settings.”
To disable the network connection: select the network adapter that you want to disable and click on “Disable this network device” (or right-click on the network connection and select Disable).
To enable the network connection: select the network adapter you want to enable, and click on “Enable this network device” (or right-click on the network connection and select “Enable”).
2. Disable or Enable the Network Adapter in Device Manager
Open the “Device Manager”: one of the ways is to execute in the search bar or in the menu (Run is called with the Win + R keys) enter the command
devmgmt.msc and press the Enter key.
To disable the network connection: open “Network adapters”, right-click on the one you want to disable, and click on “Disable device”. In the window that appears, click on “Yes.”
To enable a network connection: open “Network adapters”, right-click on the one you want to enable, and click on “Enable device”.
3. Disable or Enable the Network Adapter Using the WMIC Command
Open a command prompt as administrator: one way is to enter
cmd in the search bar and right-click on the result found, select “Run as administrator”.
wmic nic get name, index and press Enter. Opposite the name of the network adapter that you need to enable or disable is the index that you need to remember.
To disable a network adapter, use command
wmic path win32_networkadapter where index = 1 call disable
To enable the network adapter, use command
wmic path win32_networkadapter where index = 1 call enable
4. Restart Network Adapter with Bat-file
Create a bat-file, enter the following script there necessarily in ANSI encoding:
netsh interface set interface name = “Local Area Connection” admin = DISABLED
ping 127.0.0.1 -n 6> nul
netsh interface set interface name = “Local Area Connection” admin = ENABLED
Run this bat-file as administrator.
Where “Local Area Connection” is the name of the network adapter in your Windows. It may be called “Local Area Connection 2” or “Local Area Connection 3”. For convenience, I renamed the connections to LAN, Wi-Fi, Internet, Router or Bluetooth.
Remarks: works not only in Windows 7, but also in Windows 8 and Windows 10.
Consider Using Action1 to Restart the Network Adapter if:
- You need to perform an action on multiple computers simultaneously.
- You have remote employees with computers not connected to your corporate network.
Action1 is a cloud-based IT management platform for patch management, software deployment, remote desktop, software/hardware inventory, endpoint management and endpoint configuration reporting.