Let me start this piece by stating that I am not advocating that we all ignore IPv6. There are many reasons to use it, and there is nothing wrong with it. Sure, it is more complicated than we may like… but then again, so was IPv4 when we were first introduced to it.
But alas, if you and your organization are not using IPv6, then there is no reason to have it bound to your workstations, let alone to your servers. Let’s get rid of it… for now, knowing we can come back and re-enable it with a simple cmdlet.
First, we need to see which network cards have IPv6 bound to it, with the following:
Get-NetAdapterBinding | where {$_.ComponentId -eq ‘ms_tcpip6’}
That will return a list of NICs that have IPv6 enabled, like so:
We can remove the binding from each adapter individually, like so:
Disable-NetAdapterBinding -Name “Wi-Fi 2” -ComponentID ms_tcpip6
Of course, then we would have to do it for each of our NICs. Rather than doing that, it would be simpler to just use a wildcard, thus disabling it for all of our NICs simultaneously:
Disable-NetAdapterBinding -Name “*” -ComponentID ms_tcpip6
Of course, in order to do this, you must open PowerShell with elevated credentials, so make sure you Run As Administrator.
Once you have done that, you can then go back and get the same list. Notice that the listings under Enabled all read False now.
Now, as you may have heard me say before, PowerShell is very easy to understand… it is almost as if it were post-troglodyte grammar. Get-Thing! Disable-NetAdapterBinding! So it stands to reason that the reverse of the Disable-NetAdapterBinding cmdlet would be… yes, you guessed it! Enable-NetAdapterBinding! But this time, rather than using the wildcard, let’s just do it for the NIC that I am currently using:
Enable-NetAdapterBinding -Name “W-Fi 2” -ComponentID ms_tcpip6
From this, we will now get the following results:
…and just like that, we can now enable and disable a protocol on demand.
By the way, if you are not fond of ComponentIDs, you can also use the actual display names:
Of course, that is too much typing for a lot of people, so you could shorten it with wildcards… or you can just cut and paste the ComponentID cmdlets.
Have fun guys, and script on!
Leave a Reply