Smeterlink
Smeterlink

Reputation: 786

How to turn on Wi-Fi Software radio status with PowerShell

-EDITED- Solved here: https://superuser.com/questions/1698403/how-to-turn-on-or-off-wi-fi-software-radio-status-with-powershell

Any help how can I turn on/off the software radio status on Windows 11? This is the status of my Wi-Fi:

Netsh WLAN show interfaces

There is 1 interface on the system:

    Name                   : Wi-Fi
    Description            : Killer Wireless-n/a/ac Wireless Network Adapter
    GUID                   : xx
    Physical address       : xx
    Interface type         : Primary
    State                  : disconnected
    Radio status           : Hardware On
                             Software Off

    Hosted network status  : Not available

This is the setting in Windows 11: enter image description here

Upvotes: 0

Views: 863

Answers (2)

Art
Art

Reputation: 21

I've been using this in a standard batch file:

    explorer ms-settings:network-wifi
    ping  localhost > nul
    :VBSDynamicBuild
    SET TempVBSFile=%tmp%\~tmpSendKeysTemp.vbs
    IF EXIST "%TempVBSFile%" DEL /F /Q "%TempVBSFile%"
    ECHO Set WshShell = 
    WScript.CreateObject("WScript.Shell")>>"%TempVBSFile%"
    ECHO WshShell.SendKeys "{TAB}">>"%TempVBSFile%"
    ECHO WshShell.SendKeys " ">>"%TempVBSFile%"
    CSCRIPT //nologo "%TempVBSFile%"

It basically opens up the "System", "Network & internet" window and toggles the WiFi on/off button. Run the batch file once to toggle it to the other state, and run the batch file again to toggle it back. I use the ping to delay the running of the script until after the "Network & internet" window has opened.

Upvotes: 0

RetiredGeek
RetiredGeek

Reputation: 3158

Here's some PS code to do the trick:

#Disable Network?

Try {

        $NICs = Get-NetAdapter -Name * | 
                Where-Object {$_.Status -eq "Up" -and
                              $_.InterfaceName -like "*wireless*"} |
         disable-NetAdapter -Confirm:$True
     }

Catch [System.Management.Automation.CommandNotFoundException] {
       "Get-NetAdapter CmdLet NOT available."
}

Notes:

If you want to disable regardless of the Status eliminate the first test in the Where-Object clause.

If you don't want to confirm turning it off replace -Confirm:$True w/ -Confirm:$False.

This code will disable ALL wi-fi adapters but could be adjusted to do only select ones.

Upvotes: 1

Related Questions