Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finds a wired connection is plugged in but doesn't actually disable wired connection #3

Open
nsumner42 opened this issue Dec 4, 2021 · 2 comments

Comments

@nsumner42
Copy link

It tries but never is able to actually disable the wired connection. This is on a Dell OptiPlex 7090 running Windows 11. Any ideas?

@nsumner42
Copy link
Author

I found the problem. If I run the following I get the following output.

PS C:\WINDOWS\system32> Get-NetAdapter -Name Wi-Fi

Name InterfaceDescription ifIndex Status MacAddress LinkSpeed


Wi-Fi Intel(R) Wi-Fi 6 AX201 160MHz 9 Up 5C-E4-2A-14-7E-7C 400 Mbps

Now it so happens that the script did the following.
$WLANAdapters = Get-NetAdapter -InterfaceDescription Wireless,WiFi

Therefore $WLANAdapters was blank because the description didn't match. I have now modified the script (in 2 places) to be as follows.

$WLANAdapters = Get-NetAdapter -InterfaceDescription Wireless,WiFi,Wi-Fi

It is actually kind of funny I am suspicious that this is actually a pure bug. Because the following comes from the psm1 file.
$NetworkConnectionsWLAN = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=TRUE" | Where-Object {($.Description -notlike "Virtual") -and ($.Description -notlike "VPN") -and ($.Description -notlike "Zscaler") -and ($.Description -notlike "VMware") -or ($.Description -like "Wireless") -or ($.Description -like "Wi-Fi")}

Hence the description is NOT WiFi as in the ps1 file but actually Wi-Fi. I have a suspicion that somebody at some point made a very small mistake because as it happens if the description were WiFi the psm1 file wouldn't work. So my conclusion is this was a silly little typo or modification by somebody somewhere. I might well post my own fork which to be honest contains exactly the one change Wi-Fi instead of WiFi. If of course there is an adapter that the description is WiFi it would be better to add that to the psm1 and leave both options. I don't know if it exists of course.

@jchristens
Copy link
Owner

jchristens commented Dec 6, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants