Thursday, December 17, 2020

Disable NIC Command Line

In this tutorial, we will discuss how to view the network list from the command-line interface from the Microsoft Windows environment. At the same time, we will also discuss how to disable or enable a network interface card from the command line. In Windows, we have two separate command-line tools to work with the network adapter. One is the "Netsh" tool and the other one is the "Powershell" tool. The "Powershell" is the updated version of the "Netsh" tool. 

In this tutorial, we will learn command using both of the tools. First of all, we will discuss the "Netsh" command. There is no separate window for the "Netsh" tool. The "Netsh" tool is running into the "Command Prompt" interface.

That's why to execute the "Netsh" command we will have to open the "Command Prompt" tool. From the "Run" program, use the "cmd" command to open the "Command Prompt" tool or go to the "Start" menu, then "Windows System" and click on the "Command Prompt" tool.

To view the network list using the "Netsh" tool, execute the below command:-

Netsh interface show interface

To disable the specific network interface, execute the below command:-

netsh interface set interface "Ethternet 2" disable

[Replace Ethernet 2 with your network adapter name]


To enable the network interface, execute the below command:-

netsh interface set interface "Ethternet 2" enable

[Replace Ethernet 2 with your network adapter name]


Now we will use the "PowerShell" tool.

To view the network interface list, execute the below command:-

Get-NetAdpater  |  format-list

To disable the network adapter, please execute the below command:-

Disable-NetAdapter -Name "Ethernet 2" -Confirm:$false  [Replace Ethernet 2 with your NIC name]

To enable the network adapter, please execute the below command:-

Enable-NetAdapter -Name "Ethernet 2" -Confirm:$false  [Replace Ethernet 2 with your NIC name]

That's it. Using this command, one administrator makes a script to reduce the administrative overhead.

No comments:

Post a Comment