Open nsumner42 opened 2 years ago
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 Win32NetworkAdapterConfiguration -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.
It's a powershell script which was usefulon Windows 7, on Windows 10/11 there should be a GPO function for this if your domain level is high enough.
Or if you're on a workstation computer:
On Sat, 4 Dec 2021, 21:53 nsumner42, @.***> wrote:
It tries but never is able to actually disable the wired connection. This is on a Dell OptiPlex 7090 running Windows 11. Any ideas?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jchristens/Install-WLANManager/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD2FYRTTW2O3O5WPTS27Y3DUPJ5VVANCNFSM5JL6VQBA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
It tries but never is able to actually disable the wired connection. This is on a Dell OptiPlex 7090 running Windows 11. Any ideas?