Disable IPV6 on specific NIC via PowerShell using a Com Object on Windows Server 2008 R2? Disable IPV6 on specific NIC via PowerShell using a Com Object on Windows Server 2008 R2? powershell powershell

Disable IPV6 on specific NIC via PowerShell using a Com Object on Windows Server 2008 R2?


Microsoft has a command line program 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 box in adapter settings dialog. You can launch this program from a script or your program.

The command line arguments to disable IPv6 on a particular interface is:

nvspbind -d {GUID} ms_tcpip6


First before removing IPV6 you'better read these Microsoft articles :

How to disable IP version 6 (IPv6)

What are Microsoft's recommendations about disabling IPv6?

In summary you can disable IPV6 on all interfaces using (detailled explanation here):

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters]“DisabledComponents”=dword:ffffffff

Edited

According to @David Brabant comment to desable IPV6 on only one adapter you can bind or unbind it with the registry key :

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip6\Linkage]"Bind"=RegmultiSZ

of the form :

\Device\{DBB82A20-A485-4CB6-AD31-EF14B91F5EFB}

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


I use simple .bat files with the "netsh" command. You can certainly use "netsh" with Powershell, if you prefer.