-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDisable-IPv6_All_Adapters_GUI_Source.ps1
More file actions
55 lines (42 loc) · 1.68 KB
/
Disable-IPv6_All_Adapters_GUI_Source.ps1
File metadata and controls
55 lines (42 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$Adapter = Get-NetAdapterBinding |where-Object ComponentID -EQ 'ms_tcpip6' | Where-Object Name -notlike "*Bluetooth*"
Write-Host "---------------------------" -Foregroundcolor Green
Write-Host "| Created By: Ryan Curran |" -ForegroundColor Green
Write-Host "---------------------------" -ForegroundColor Green
"Adapters Loaded`n"
$Val = 1
function AdapterSwitch{
$Title = "Choose options 1, 2 or 3 to proceed."
$Info = Write-host "Would you like to enable or disable IPv6 on all adapters?" -Foregroundcolor Yellow -Backgroundcolor Black
$options = [System.Management.Automation.Host.ChoiceDescription[]] @("&1. Enable", "&2. Disable", "&3. Quit")
[int]$defaultchoice = 1
$opt = $host.UI.PromptForChoice($Title, $Info , $Options,$defaultchoice)
switch($opt)
{
0 {
Write-Host "Enable IPv6" -ForegroundColor Green
Foreach ($Adapt in $Adapter){
Enable-netadapterbinding -Name $adapt.name -ComponentID 'ms_tcpip6'
"Enabling $($Adapt.name)'s IPv6"
}
"`nIPv6 has been disabled from $($Adapter.Count) adapters.`n"
$val = 0
}
1 {
Write-Host "Disable IPv6" -ForegroundColor Green
Foreach ($Adapt in $Adapter){
Disable-netadapterbinding -Name $adapt.name -ComponentID 'ms_tcpip6'
"Disabling $($Adapt.name)'s IPv6"
}
"`nIPv6 has been disabled from $($Adapter.Count) adapters.`n"
$val = 1
}
2 {
Write-Host "Quit" -ForegroundColor Red
$val = 2
Exit
}
}
}
While($val -ne 2){
AdapterSwitch
}