Disabling IPv6 with PowerShell

PSLet me preface this piece by saying that I usually do not disable IPv6. There are advantages to leaving it on (even if you think you are not using it) which I will not go into here. With that said, I was building a server for a lab environment recently, and IPv6 was interfering with something that I needed to do. I had to look it up, so here it is.

The first thing you have to do is to modify the registry. I know, that sounds a bit extreme, but if you want to completely disable it, that is what you have to do. In PowerShell, run the following command:

reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 0xFF /f

Once that is done, you should then disable IPv6 tunneling, as there is malware that has been to discover to make use of this tunneling to escape and spread. Use the following cmdlet:

Get-NetAdapterBinding –ComponentID “ms_tcpip6” | disable-NetAdapterBinding –ComponentID “ms_tcpip6” –PassThru

After you have successfully executed both of these, you need to reboot the server.

That’s it! Go ahead and try it… but only if you need to!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: