Last active
May 22, 2025 20:53
-
-
Save SweetAsNZ/a32873c64407815e4258c7e1973dfeaa to your computer and use it in GitHub Desktop.
Disable IPv6 Properly with Windows PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Disable-iPv6 { | |
#Requires -RunAsAdministrator | |
# Self-elevate the script if required | |
if( ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $false){ | |
Write-Warning "Run As Admin Required" | |
} | |
if( ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $true){ | |
Write-Host -f Green "Running As Admin - Success" | |
} | |
(([Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) | |
Get-Netadapter | Get-NetAdapterBinding -ComponentID 'ms_tcpip6' | |
Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6 | |
#:: Disables the Teredo tunneling. Teredo is a transition technology that gives | |
#:: full IPv6 connectivity and host-to-host automatic tunneling | |
#:: for unicast IPv6 traffic. | |
cmd /c netsh interface teredo set state disabled | |
#:: Disables the 6to4 tunnels that support communication with IPv6 internet | |
cmd /c netsh interface ipv6 6to4 set state state=disabled undoonstop=disabled | |
#:: Disables all IPv6 transition technologies | |
cmd /c netsh interface ipv6 isatap set state state=disabled | |
if($Host.Name -like "*ISE*"){ | |
$IfRestart = Read-Host "Restart Computer (F=Force) Y/N/F?" | |
} | |
if($IfRestart -ieq 'F'){ | |
Write-Host -f Yellow "RESTARTING With FORCE per Request via: $($IfRestart)" | |
Restart-Computer -Force | |
} | |
if($IfRestart -ieq 'Y'){ | |
Write-Host -f Yellow "RESTARTING With FORCE per Request via: $($IfRestart)" | |
Restart-Computer | |
} | |
if($IfRestart -ieq 'N'){ | |
Write-Host -f Green "Not Restarting per Request via: $($IfRestart)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment