I need to programmatically control the state of the WLAN button (either turning it on or off). It doesn't matter whether it’s done through PowerShell or any other programming language, as long as it accomplishes the task.
Before asking this question, I already tried using the PowerShell command:
Disable-NetAdapter -Name "Wi-Fi" -Confirm:$false
However, this command makes the WLAN button invisible, essentially disabling the Wi-Fi adapter at the hardware level.
Another solution from Stack Overflow suggests using:
Set-NetAdapterAdvancedProperty -Name "Wi-Fi" -AllProperties -RegistryKeyword "radioEnable" -RegistryValue "0"
or
Set-NetAdapterAdvancedProperty -Name "Wi-Fi" -AllProperties -RegistryKeyword "SoftwareRadioOff" -RegistryValue "1"
Unfortunately, these two commands only work for Windows 10 because the RegistryKeyword
entries radioEnable
and SoftwareRadioOff
have been removed in Windows 11. Here is the Stack Overflow link: https://stackoverflow.com/questions/43486244/how-to-switch-wifi-state-on-off-with-powershell-windows-10
Afterwards, I tried using the software RegShot to compare the changes in the registry before and after turning off the WLAN button. I compiled a list of seemingly relevant changes and attempted to manually modify these entries in the registry, but it didn’t have any effect. Therefore, I suspect that clicking the button calls a function from a Windows DLL. Later, I found WlanRadioManager.dll
and tried to decompile it using Ghidra, but my limited knowledge of C++ made it difficult to understand the code logic.
I would greatly appreciate any insights or assistance with this issue. If anyone has experience or suggestions on how to approach this, your help would be invaluable. Thank you in advance for your time and support!