1

I have two Wifi networks, one fast, one slow. The fast one has a monthly data limit, the slow one does not. My desktop does backups every night, and these can add significantly to the data limit, so I'd like to automatically switch to the slow network say at 10pm every night, and switch back in the morning. Is this possible?

Update 1: this fails every night switching to the slower network, which is: SFR_F280, SFR_F280_2GEXT, or SFR_F280_5GEXT (for the extender). I try all 3 in the batch file:

netsh wlan connect ssid="SFR_F280_2GEXT" name="SFR_F280_2GEXT"
if not errorlevel 1 goto :EOF
netsh wlan connect ssid="SFR_F280_5GEXT" name="SFR_F280_5GEXT"
if not errorlevel 1 goto :EOF
netsh wlan connect ssid="SFR_F280" name="SFR_F280"
if not errorlevel 1 goto :EOF

giving:

Profiles on interface Wi-Fi:

Group policy profiles (read only)
---------------------------------
    <None>

User profiles
-------------
    All User Profile     : SFR_F280
    All User Profile     : PSV 3229_5G
    All User Profile     : SFR_F280_2GEXT
    All User Profile     : SFR_F280_5GEXT
    All User Profile     : PSV 3229
    All User Profile     : AndroidAPacf 2
    All User Profile     : AndroidAPacf
    All User Profile     : ATT5dSYKI2
    All User Profile     : TP-Link_Extender
    All User Profile     : ATTYK9a3A2

The network specified by profile "SFR_F280_2GEXT" is not available to connect.
The network specified by profile "SFR_F280_2GEXT" is not available to connect.
The network specified by profile "SFR_F280" is not available to connect.

I've no idea why it can't switch.

Update 2: It turns out the wifi networks aren't stored and that a rescan is necessary to reload them all. From this thread Force refresh (re-scan) wireless networks from command line the following works:

explorer.exe ms-availablenetworks:
sleep 10

This is the CMD equivalent to manually opening the network icon in the lower right of the toolbar. The sleep is required to give it time to complete the scan.

Ferrad
  • 13
  • 3
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 15 '22 at 08:31
  • Looks pretty clear to me. I am trying to switch Wifi networks automatically at a certain time every day. – Ferrad Mar 15 '22 at 08:39

1 Answers1

1

Yes, you can use task scheduler to execute a command at a certain time to switch Wi-Fi network.

First you need to get a list of the available profiles:

netsh wlan show profile

To connect to one of the profiles you need to execute the following:

netsh wlan connect ssid=<your Wi-Fi SSID> name=<your profile name>

You’ll need two scheduled tasks, one that runs at 10pm and another that runs at (say) 8am but with the setting enabled to run as soon as possible if the task is missed.

Richard
  • 5,831
  • 9
  • 44
  • 73
  • Thanks. I guess SSID is the name of the Wifi network, but where do I find the Profile name? – Ferrad Mar 15 '22 at 08:06
  • @Ferrad I'd guess that's the first command listed: `netsh wlan show profile` – Mokubai Mar 15 '22 at 08:09
  • @Mokubai that shows the SSID - is the SSID the same as the Profile Name? – Ferrad Mar 15 '22 at 08:16
  • 1
    @Ferrad profiles are typically named from the SSID, [unless you have renamed it somehow](https://www.howtogeek.com/364291/how-to-change-or-rename-the-active-network-profile-name-in-windows-10/), so it is entirely possible that they are the same. – Mokubai Mar 15 '22 at 08:24
  • @Mokubai I have not changed them. But it would be useful to be able see both the SSID and Profile Name to be 100% sure. – Ferrad Mar 15 '22 at 08:36
  • 1
    @Ferrad `netsh wlan show profile name="yourProfile"` should show the associated SSID – Mokubai Mar 15 '22 at 08:43
  • @Mokubai yes, it does, thank you – Ferrad Mar 15 '22 at 08:47