Thursday, December 17, 2020

Powershell Command Disable NIC

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 commands using 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