How to disable IPv6 with Powershell

In some scenarios, working with IPv6 causes a lot of issues, because the request is made to IPv6 rather than IPv4, so the DNS lookup just fails. Typically, IPv6 is not deployed but if you’re in the same boat as me, do the following:

New-ItemProperty -Path HKLM:SYSTEMCurrentControlSetservicesTCPIP6Parameters -Name DisabledComponents -PropertyType DWord -Value 0xffffffff
Restart-Computer -ComputerName $env:computername -Force

And that’s all!