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

Page 1 of 2 12 LastLast

  1. Posts : 87
    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 ComputerSystem Spec

  2. Kari's Avatar
    Posts : 16,320
    Windows 10 Pro
       #2

    stanhilliard said: View Post
    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)

    Click image for larger version. 

Name:	image.png 
Views:	68 
Size:	420.2 KB 
ID:	234279

    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:

    Click image for larger version. 

Name:	image.png 
Views:	1 
Size:	79.8 KB 
ID:	234289

    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:

    Click image for larger version. 

Name:	image.png 
Views:	76 
Size:	121.7 KB 
ID:	234281

    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:

    Click image for larger version. 

Name:	image.png 
Views:	75 
Size:	21.6 KB 
ID:	234284

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

    Click image for larger version. 

Name:	image.png 
Views:	75 
Size:	30.3 KB 
ID:	234282

    Click image for larger version. 

Name:	image.png 
Views:	74 
Size:	28.1 KB 
ID:	234283

    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 ComputerSystem Spec


  3. Posts : 804
    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 ComputerSystem Spec

  4. Kari's Avatar
    Posts : 16,320
    Windows 10 Pro
       #4

    margrave55 said: View Post
    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 ComputerSystem Spec


  5. Posts : 87
    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.
    Click image for larger version. 

Name:	image.png 
Views:	62 
Size:	12.2 KB 
ID:	234430
      My ComputerSystem Spec

  6. Kari's Avatar
    Posts : 16,320
    Windows 10 Pro
       #6

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

    Kari
      My ComputerSystem Spec



  7. Posts : 87
    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 ComputerSystem Spec

  8. Kari's Avatar
    Posts : 16,320
    Windows 10 Pro
       #8

    stanhilliard said: View Post
    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 ComputerSystem Spec


  9. Posts : 87
    Windows 10
    Thread Starter
       #9

    Kari said: View Post
    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 ComputerSystem Spec


  10. Posts : 3
    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 ComputerSystem Spec


 
Page 1 of 2 12 LastLast

Related Threads
HI, I am a newb to the forum this is my first post. My network topology is Comcast Modem>Switch>Wireless Access Point My Win 10 Desktop is connected to the switch for Internet Access. The network printer is connected to the Wireless...
Solved Ethernet is slower than wireless.... in Network and Sharing
I have a problem that my IP says is my Ethernet adapter... I have updated drivers, and tried just about everything, with no success.. My wireless speed is 117mbps/23mbps consistently.. However my direct to my modem Ethernet cable gets no better than...
Ethernet vs. wireless in Network and Sharing
Is there such a thing as a 5 Ghz Ethernet card, or is just 5 Ghz wireless?
Hello, I have two network adapters in Windows 10 one wifi for connecting to internet and one Ethernet for local network. I need to configure wifi adapter to public network and Ethernet to private network but i can't. Inverse it work ( wifi to...
Configure a wireless repeater in Network and Sharing
Hi guys, I hope you are having a good day! My name is Alex. I configured my repeater for home network yesterday but everything was seemed to work incorrectly. The repeater kept dropping connection. So I would like to ask you guys about this. My...
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 05:45.
Find Us