r/PowerShell • u/LegitimateEye8153 • Jan 06 '26
Creating a powershell script that toggle IPv6
Hello ,
I want to ask if i can write a script and make it run automatically when windows start to enable ipv6 if it disabled or disable it if enabled because i have a problem , computers can't read domain and show undefiend network so it takes long time to signout .
0
Upvotes
23
u/omfgitzfear Jan 06 '26
You can write a script to do that, thank you for asking.
6
u/purplemonkeymad Jan 06 '26
I would just look at your ipv6 setup for the domain and fix that so that you don't have the issue at all. Sounds like less work than messing with toggling ipv6 with a script and dealing with all the issues that has.
5
u/MiserableTear8705 Jan 06 '26
I don’t think you’re having the problem you think you’re having. IPv6 isn’t causing your issues
11
u/WinkMartin Jan 06 '26
Your idea is not the way to solve this problem.
2
u/databeestjegdh Jan 06 '26
You are using the incorrect IPv6 DNS servers for your domaain, arn't you
2
u/BlackV Jan 06 '26
This is not a solution to your problem, it is a dirty workaround, you should think about not doing this.
But Microsoft have a specific article on properly disabling ipv6 (they also recommend you don't do that) with a reg key
Show us what you have tried and what issue you're having, we can help with that, otherwise this is a basic /r/windows issue rather than a /r/powershell issue
2
u/Particular_Fish_9755 Jan 07 '26
Not a PowerShell issue. The cause of the problem should be investigated by a sysadmin, the script you want might be masking a bigger problem.
Oh, you are the sysadmin ? So…
-Check IP and DNS Settings
-Scripts on start and logon, include printers mapping
-Disk space, temporary files, pending updates
-...
There are old registry keys that were used on slow networks in Windows NT/2000/XP; it remains to be seen if they are still functional in 10 and 11 (Meh, I can't find them in the Microsoft documentation anymore... so try ?) :
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SlowLinkDetectEnabled -> 1
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SlowLinkTimeOut -> default 2000 (2 seconds), min 0, max recommended 30000)
You can read this too.