PowerShell: disable IPv6 on network adapters
PowerShell commands to list the IPv6 bindings of Windows network adapters and disable ms_tcpip6 with the NetAdapter module.
These PowerShell commands list the network adapters that have the IPv6 protocol (ms_tcpip6) bound to them, and then disable it. They use the NetAdapter module available on Windows.
List the network adapter bindings
Get-NetAdapterBinding
Filter the IPv6 binding
Show only the IPv6 binding of each adapter:
Get-NetAdapterBinding | Where {$_.ComponentID -eq "ms_tcpip6"}
Keep only the IPv6 bindings that are enabled:
Get-NetAdapterBinding | Where {$_.ComponentID -eq "ms_tcpip6" -and $_.Enabled -eq "True"}
Disable IPv6 on the matching adapters
Variant using a loop:
Get-NetAdapterBinding | Where {$_.ComponentID -eq "ms_tcpip6" -and $_.Enabled -eq "True"} | % {Disable-NetAdapterBinding -InterfaceDescription $_.InterfaceDescription -ComponentID ms_tcpip6 }
Pipeline variant:
Get-NetAdapterBinding | Where {$_.ComponentID -eq "ms_tcpip6" -and $_.Enabled -eq "True"} | Disable-NetAdapterBinding -ComponentID ms_tcpip6
Notes
- These commands disable IPv6 on every adapter that matches the filter. Check the list returned by the first command, and test on a non-production machine before applying them more widely.
- Some Windows components or services may depend on IPv6. Verify these dependencies before disabling it.