Reputation: 125
I need to script some Windows Server 2008 R2 builds, preferably in PowerShell. I need to disable or uncheck IPV6 on a specific NIC (the same NIC every time). Currently, I have to set it manually. I do not want to disable IPV6 completely for the entire server other things may use that in the future. Is there an object I can reference in a PowerShell command specifying my NIC "Intel(R) PRO/1000 MT Network Connection" and disable IPV6? Unfortunately, Group Policy is not an option says the boss. I've tried finding an appropriate WMI object via "PowerShell Scriptomatic" but failed to find the difference between an enabled setting versus disabled on the Intel NIC. Thanks in advance.
Upvotes: 3
Views: 21825
Reputation: 300
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
Upvotes: 6
Reputation: 72680
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
Upvotes: 1
Reputation: 121809
I use simple .bat files with the "netsh" command. You can certainly use "netsh" with Powershell, if you prefer.
Upvotes: -2