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
View all comments
Show parent comment
1
u/mrmattipants Jan 10 '26 edited Jan 10 '26
I recently had a similar issue with a server that took upwards of 15-20 minutes to sign into or out of. While I initially thought might be DNS/Domain related, I came across several Event Logs pertaining to Failing Group Policies, pointing me elsewhere.
This eventually lead me to the "WMI Activity" Event Logs, which contained Error messages pertaining to WQL Queries associated with the GPO WMI Filters.
For good measure, I ran a "Get-WMIObject" Query, in PowerShell, which hung indefinitely without producing a result. This all but confirmed that WMI was the probable culprit and fortunately, after repairing the WMI Repository produced a resolution.
That being said, I'm not saying that this is your exact issue (those suggesting it may be DNS/Network related, above, are probably correct). I'm merely giving an example that underlines the fact that the problem is not always that which appears most apparent.
I should also note that I've had one legitimate reason to disable IPv6, since it's implementation and that was due to a vulnerability (CVE-2024-38063) that we couldn't patch.
In short, the affected systems were running Windows Server 2012, for which support had just ended the year prior and the client wasn't interested in purchasing an extended support package, as we were already in the process of planning an OS upgrade.
Regardless, with a little persistence, the evidence will eventually lead you to the underlying issue.