How to choose different adapter using `netsh wlan set hostednetwork`(Windows 10)

7,469

The key here is to disable the adapters that you don't want the hostednetwork to start on. If you only have one active adapter and run:

netsh wlan set hostednetwork mode=allow ssid=Your_SSID key=Your_Passphrase
netsh wlan start hostednetwork

then it will auto assign itself to that adapter.

Since you have 2 wireless adapters, wifi1 and wifi2, and you want it to run on wifi2, you can disable wifi1, run script, then enable wifi1 again. This forces hostednetwork on wifi2.

Code:

netsh interface set interface name="Wi-Fi1" admin=disabled
netsh wlan set hostednetwork mode=allow ssid=Your_SSID key=Your_Passphrase
netsh wlan start hostednetwork
netsh interface set interface name="Wi-Fi1" admin=enabled

Note: May need to run this batch as administrator.

Share:
7,469

Related videos on Youtube

James Vickery
Author by

James Vickery

Updated on September 18, 2022

Comments

  • James Vickery
    James Vickery almost 2 years

    I am following this tutorial to set up a Wifi hotspot from my Windows 10 PC.

    When I run netsh set hostednetwork mode=allow ssid=Your_SSID key=Your_Passphrase, I think it uses the adapter called Wi-Fi. I have a USB Wifi dongle that I want to use for my hotspot, which is listed as Wi-Fi 2.

    Is there a way I can change the above command to use the USB dongle instead of my laptop's built-in Wifi adapter?

  • skan
    skan over 6 years
    But what if you want to have both enabled because you want to create a brdige between them o because you want to use them for different things?
  • Narzard
    Narzard over 6 years
    @skan They are both enabled. You just turn one off for a brief second to apply your hostednetwork to the desired interface. Note that you cannot apply a hostednetwork (virtual AP) to a bridged interface or bridge an adapter using the AP. "bridging is prohibited between the AP adapter and any other adapters in the system" msdn.microsoft.com/en-us/library/windows/desktop/…
  • skan
    skan over 6 years
    I have two adapters, I want to use one a client to connect my laptop to my wifi and use the other as an AP to repeat the signal.
  • jerinho.com
    jerinho.com about 5 years
    what if you want to run the commands on startup?
  • Narzard
    Narzard about 5 years
    @jerinho then save the above as a .bat file, open Task Scheduler and setup as normal with the trigger being set to the "on startup" option.