Powershell - Managing the status and configuration of network interfaces

To support me, you can subscribe to the channel, share and like the videos, disable your ad blocker, purchase my 3D plans, or make a donation or subscribe on Ko-Fi. Thank you!

Hello, here is a set of commands for viewing and modifying the status and configuration of network interfaces. The menu includes renaming a network interface, disabling IPv6, enabling/disabling an interface, etc.

There are other commands specific to the configuration of VMQ, QOS, RDMA, RSS, SRIOV, etc. that I won’t go into in this article.

IP configuration will be the subject of a future article.

# List network commands with the status and configuration of network interfaces
Get-Command -Noun NetAdapter*
# List network interfaces
Get-NetAdapter
# List physical network interfaces only
Get-NetAdapter -Physical
# List enabled physical network interfaces only
Get-NetAdapter -Physical | Where-Object Status -eq Up
# List network interfaces as well as hidden ones
Get-NetAdapter -IncludeHidden
# List a network interface using its description
Get-NetAdapter -InterfaceDescription *realtek* # List a network interface using its description
# List a network interface using its index
Get-NetAdapter -InterfaceIndex 4
# List a network interface using its name
Get-NetAdapter -Name ‘Ethernet 3’
# List a network interface using its name and a wildcard character
Get-NetAdapter -Name ‘Ethernet*’ # Rename a network interface using its name and wildcard character
# Rename a network interface
Rename-NetAdapter -Name Ethernet -NewName LAN
# Enable a network interface
Enable-NetAdapter -Name Ethernet
# Disable a network interface
Disable-NetAdapter -Name Ethernet
# Display information such as status, link speed or Vlan ID
Get-NetAdapter | Select-Object -Property Name, Status, Linkspeed, VlanID
# Display information such as the driver used by a network interface
Get-NetAdapter | Select-Object -Property Name, DriverName, DriverVersion, DriverInformation, DriverFileName
# Display all the properties of a network interface
Get-NetAdapter -Name Ethernet | Select-Object -Property *
# Rename a network interface
Get-NetAdapter -Name Ethernet | Rename-NetAdapter -NewName LAN1
# Display the bindings (transport or filter) of network interfaces
Get-NetAdapterBinding -Name Ethernet -AllBindings
# List network interfaces with IPv6 enabled
Get-NetAdapterBinding -Name * | Where-Object -FilterScript { ($_.ComponentID -eq 'ms_tcpip6') -and ($_.Enabled -eq $true) }
# Disable IPv6
Set-NetAdapterBinding -Name Ethernet -ComponentID ms_tcpip6 -Enabled $false
# Display the status of network interface power management functions
Get-NetAdapterPowerManagement -Name Ethernet | select Name, WakeOnMagicPacket
# Modify the state of a network interface power management feature
# Enable WakeONlAN
Set-NetAdapterPowerManagement -Name Ethernet -WakeOnMagicPacket Enabled
# Note: the interface must be restarted to apply the configuration.
# Restart a network interface
Restart-NetAdapter -Name LAN
# Display the advanced configuration of the network interface
Get-NetAdapterAdvancedProperty -Name Ethernet | Select-Object -Property DisplayName, DisplayValue, ValidDisplayValues
# Or
Get-NetAdapterAdvancedProperty -Name Ethernet | Select-Object -Property DisplayName, RegistryKeyword, Registryvalue
# Modify an advanced network interface configuration using display values
Set-NetAdapterAdvancedProperty -Name Ethernet -DisplayName 'Vlan ID' -DisplayValue 2
# Note: the interface must be restarted to apply the configuration.
# Modify an advanced network interface configuration using registry values
Set-NetAdapterAdvancedProperty -Name Ethernet -RegistryKeyword RegVlanid -RegistryValue 2
# Note: This modification requires the interface to be restarted in order to apply the configuration.

Related links