Disable IPV6 on specific NIC via PowerShell using Com object in Windows Server 2008 R2?

I need a script build of Windows Server 2008 R2, preferably in PowerShell. I need to disable or disable IPV6 on a specific network adapter (same network adapter every time). Currently I have to install it manually. I don't want to completely disable IPV6 for the whole server and other things might use this in the future. Is there an object I can reference in a PowerShell command that detects my "Intel (R) PRO / 1000 MT" NIC network connection and disable IPV6? Unfortunately, Group Policy is not an option, the boss says. I tried to find a suitable WMI object through "PowerShell Scriptomatic" but could not find the difference between the option enabled and disabled in the Intel NIC. Thanks in advance.


source to share

3 answers

Before uninstalling IPV6, you can read these Microsoft articles:

How to disable IP version 6 (IPv6)

What's Microsoft's recommendation to disable IPv6?

In conclusion, you can disable IPV6 on all interfaces using (detailed explanation here ):




As per @David Brabant's comment about allowing IPV6 on only one adapter, you can bind or unbind it using a registry key:






You can build this line with:

# Public Name NetworkCard Name
$networkCardName = "Connexion au réseau local 1"

# Get Device GUID
$guid=(gwmi -query "select * from win32_networkadapter where netconnectionid= '$networkCardName'").guid




Microsoft has a command line utility called nvspbind ( https://gallery.technet.microsoft.com/Hyper-V-Network-VSP-Bind-cf937850 ) that can disable ipv6 on a specific interface. It seems to be identical to unchecking the IPv6 checkbox in the adapter settings dialog. You can run this program from a script or your program.

Command line arguments to disable IPv6 on a specific interface:

nvspbind -d {GUID} ms_tcpip6




I am using simple .bat files with the "netsh" command. You can of course use "netsh" with Powershell if you like.



All Articles