How to configure Ethernet and wireless channels on the same computer?

Page 1 of 2 12 LastLast

  1. Posts : 180
    Windows 10
       #1

    How to configure Ethernet and wireless channels on the same computer?


    I have a Netgear 7000 router. My desktop computer is normally connected by Ethernet cable to the router. My two laptops are wireless.

    My goal is to add the option to connect the desktop computer to the internet by wireless or Ethernet, so I recently added a USB wireless dongle.

    When I choose the wireless route, the cabled option does not turn off. Both wired and wireless options show as connected. They are both using the same SSID. There is no indication which path to the router is actually used. This does not seem right to me.

    Is there a better way to set this up so I can choose to access the internet by wireless or Ethernet?

    - - - Updated - - -

    The above was a non-repeatable situation. Startup next day was OK after reboot of modem, router, and PC. Is working with Ethernet, but can't switch to wireless because "can't connect to the network" message.

    How can I connect by wireless without unplugging the cable?
      My Computer


  2. Posts : 17,661
    Windows 10 Pro
       #2

    stanhilliard said:
    How can I connect by wireless without unplugging the cable?
    This is relatively easy using two batch files to connect to preferred network adapter, disconnecting the other.

    First, enter following command in Command Prompt to find out Index values for both wired and wireless network adapters (#1 in next screenshot):

    wmic nic get name, index

    In this example case, wired NIC is 2, and wireless 4 (#2 & #3 in screenshot).

    Now enter following command to find out wireless network profile name (#4):

    netsh wlan show profiles

    Note the profile name (#5)

    How to configure Ethernet and wireless channels on the same computer?-image.png

    OK, now the two batch files needed.

     Batch 1: Disconnect Ethernet (wired) connection and connect to wireless

    Copy the following and paste it to new text file in Notepad. Edit NIC Index value according to your actual one, in this sample 2 is wired NIC. Also edit the Network Profile Name to match yours:

    Code:
    wmic path win32_networkadapter where index=2 call disable
    netsh wlan connect YourNetworkProfileName
    msg.exe * /time:30 Ethernet disconnected. You are now connected to wireless network

    Save the file as WIFI.bat:

    How to configure Ethernet and wireless channels on the same computer?-image.png

    When the batch is run, it disables the wired NIC, and connects to your wireless network.

     Batch 2: Disconnect wireless connection and connect to wired

    Copy the following and paste it to new text file in Notepad. Edit NIC Index values according to your actual ones, in this sample 2 is wired, 4 wireless:

    Code:
    wmic path win32_networkadapter where index=4 call disable 
    wmic path win32_networkadapter where index=4 call enable 
    wmic path win32_networkadapter where index=2 call enable
    msg.exe * /time:30 Wi-Fi disconnected. You are now connected to wired network.

    Save the file as WIRED.bat

    When the batch is run, it disables the wireless NIC, which causes the connection being disconnected. It then enables the wireless NIC again, but does not connect to it (it must be enabled next time you run the WIFI.bat). Finally, the batch enables the wired NIC. No need to connect to it, wired connection will be made automatically when wired NIC is enabled and Ethernet cable connected.

    Notice that establishing a wired connection can take a few seconds. Just wait, don't panic when Not Connected icon in notification area is shown until connection is established!

     Create elevated shortcuts

    Create a shortcut for both batch files (tutorial, see option 4).

    Set both shortcuts to be run as administrator by right clicking them and selecting Properties. In Shortcut tab of Properties, click Advanced button, select Run as administrator:

    How to configure Ethernet and wireless channels on the same computer?-image.png

    Click OK to save Advanced Properties, click OK to save Properties.

    To change icons for your shortcuts, see this tutorial: Change Icon of Shortcut in Windows 10

    Copy or move the shortcuts to desktop.

    That's it. Now you have shortcuts on your desktop to connect wired or wireless, as you'd prefer:

    How to configure Ethernet and wireless channels on the same computer?-image.png

    You will get a note on desktop to show what connection is used:

    How to configure Ethernet and wireless channels on the same computer?-image.png

    How to configure Ethernet and wireless channels on the same computer?-image.png

    The messages close automatically in 30 seconds.

    Notice that as these shortcuts are run as admin, the UAC prompt will be shown. In case you do want to make shortcuts to be run without UAC prompt, see this tutorial: Create Elevated Shortcut without UAC prompt in Windows 10

    Kari
    Last edited by Kari; 19 May 2019 at 06:09. Reason: Some typos fixed.
      My Computer


  3. Posts : 1,680
    X
       #3

    Code:
    You gave this for wifi:
    wmic path win32_networkadapter where index=2 call disable
    netsh wlan connect YourNetworkProfileName
    msg.exe * /time:30 Ethernet disconnected. You are now connected to wireless network
    
    And this for wired:
    wmic path win32_networkadapter where index=4 call disable
    wmic path win32_networkadapter where index=4 call enable 
    wmic path win32_networkadapter where index=2 call enable
    msg.exe * /time:30 Wi-Fi disconnected. You are now connected to wired network.
    But I think you meant:
    Code:
    This for wifi:
    wmic path win32_networkadapter where index=2 call disable
    wmic path win32_networkadapter where index=4 call enable
    netsh wlan connect YourNetworkProfileName
    msg.exe * /time:30 Ethernet disconnected. You are now connected to wireless network
    
    And this for wired:
    wmic path win32_networkadapter where index=4 call disable
    wmic path win32_networkadapter where index=2 call enable
    msg.exe * /time:30 Wi-Fi disconnected. You are now connected to wired network.
      My Computer


  4. Posts : 17,661
    Windows 10 Pro
       #4

    margrave55 said:
    You gave this for wifi:

    And this for wired:
    ...
    But I think you meant:
    No, I did not mean that. The WIFI.bat I posted will disable wired NIC and connect to wireless network. Wireless NIC does not have to be enabled in that batch, as it is always disabled and re-enabled in WIRED.bat. Disabling disconnects it from network, re-enabling but not re-connecting it makes it ready for next use of WIFI.bat.

    Both batch files are 100% correct, exact copies of those I use.

    Kari
      My Computer


  5. Posts : 180
    Windows 10
    Thread Starter
       #5

    I don't understand how to convert(interpret) the wmic command result here into the one on my PC. I have different components with different names so I can't look at a component and know which one of mine it corresponds yours. I will post here my wmic command result.
    How to configure Ethernet and wireless channels on the same computer?-image.png
      My Computer


  6. Posts : 17,661
    Windows 10 Pro
       #6

    Your wireless NIC is index #15, wired is #2 or #3, most probably #3.

    Kari
      My Computer


  7. Posts : 180
    Windows 10
    Thread Starter
       #7

    These batch files switch my PC between wired and WIFI:

    WIFI.bat:
    Code:
    wmic path win32_networkadapter where index=2 call disable
    netsh wlan connect samplingplans 2x5G
    msg.exe * /time:30 Ethernet disconnected. You are now connected to wireless network
    WIFI does not necessarily start connected to samplingplans 2x5G, it starts with the last used wifi connection. I am fine with that.

    WIRED.bat:
    Code:
    wmic path win32_networkadapter where index=15 call disable 
    wmic path win32_networkadapter where index=15 call enable
    wmic path win32_networkadapter where index=2 call enable
    msg.exe * /time:30 Wi-Fi disconnected. You are now connected to wired network.
    WIRED creates an Ethernet connection. The connection menu contains both the Ethernet connection and the wifi channels. When I select a wifi channel from the menu it connects -- making both wired and wifi indicate concurrently that they are connected.
      My Computer


  8. Posts : 17,661
    Windows 10 Pro
       #8

    stanhilliard said:
    WIRED creates an Ethernet connection. The connection menu contains both the Ethernet connection and the wifi channels. When I select a wifi channel from the menu it connects -- making both wired and wifi indicate concurrently that they are connected.
    I am not sure I understand you correctly? Do you mean both your batch files work as expected?

    Kari
      My Computer


  9. Posts : 180
    Windows 10
    Thread Starter
       #9

    Kari said:
    I am not sure I understand you correctly? Do you mean both your batch files work as expected?
    Thanks. Each batch file performs the action I expected.

    My PC uses Windows 10 with Classic Shell. I meant to say that in addition to the two batch files, if Ethernet is connected and I open the connection menu with the button near the right side of the task bar, it will list all the wifi channels available plus the Ethernet channel. By selecting a wifi channel I can make it indicate that both wired and wifi channels are open at the same time. That doesn't seem right to me.
      My Computer


  10. Posts : 18
    Windows 10
       #10

    Hi Kari, thanks for your help this morning it worked a treat on my main system.

    I'm now trying to recreate that on the smaller pc I have in my bedroom.

    This pc is connected via ethernet that runs from a switch near my router through the roof and down the wall.

    I also have a wireless dongle so it can connect via Wi-Fi to the US VPN.

    The wired connection is 8 and the Wi-Fi is 10 on the list.

    I have created the scripts but it will not turn off the wired network adapter.

    To fault check I ran all the numbers to be sure and sure enough it will not disable the network adapter.

    Is this because it's coming from the switch? I wouldn't think so but who knows hey.

    Any ideas? A work around maybe?

    Can attach pictures if you want.

    - - - Updated - - -

    Duuuuh *slaps self in forehead* forgot to run as Administrator.

    Sorry got the flu not running on all cylinders atm.

    Please disregard my last.

    Works a treat.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:37.
Find Us




Windows 10 Forums