4 Ways to Automatically Disable Wireless Network Connection when Local Area Connection is Enabled

4. Create a Scheduled Task to Auto Switch

Using this method relies on your computer’s LAN adapter sending an event to the Windows Event Viewer when it disconnects and reconnects. With this information you can then create tasks to disable or re-enable the Wifi adapter depending on the connection status of the wired connection. This does not work on Windows XP because it doesn’t have the option to trigger a task when a specific event is logged.

1. Go to Control Panel -> Administrative Tools -> Event Viewer. When Event Viewer is open, go to Windows Logs -> System.

2. Disconnect and reconnect your Ethernet cable a few times to generate some events. Press F5 to refresh the window and click on the newest events, hopefully you will find a “Port is up”, “link up” or similar description in the lower General tab to indicate the LAN has connected, and another one when the LAN was disconnected.

Event Viewer Port is Up

3. Make a note of the name in the Source column and the Event ID for the connect and disconnect events you found. On our Dell laptop we got a connect Event ID of 121 and disconnect of 83 with the Source name of “yukonw7”, yours will likely be different though. If you can only find a Source event for Services Control Manager and not one that looks like the LAN adapter name, this method will not work because an event needs to be generated by the Ethernet adapter itself.

Event Viewer Source
4. Go to Control Panel -> Administrative Tools -> Task Scheduler, then click on Task Scheduler Library -> Create Basic Task.

5. Give the Task a name, such as “Undock Laptop” or “Switch to Wifi” etc. Click Next, select “When a specific event is logged”, and click Next again.

Create Basic Task Wizard

6. In the Log drop down select System, find the source name from step 3 in the drop down list or type it in, then enter the Event ID for the disconnect event. Click Next, make sure Start a program is selected, click Next again.

When an event is logged

7. In the Program/script box enter C:\Windows\System32\Netsh.exe or browse for it. Enter the following into the Add arguments box:

interface set interface “Wireless Network Connection” enable

This is assuming your WiFi connection is called “Wireless Network Connection”. To check go to Control Panel -> Network and Sharing Center -> Change adapter settings, and change the name if it’s different. Click Next, review the task making sure it’s correct, then click Finish.

Start a program

8. Now you have a task that enables the WiFi on a LAN disconnect, you obviously have to do the opposite to disable the WiFi on LAN reconnect. Repeat steps 4 – 7 again, but change the name in step 5 to “Dock Laptop” or “Switch to LAN” etc, enter the connect Event ID in step 6, and on the argument line in step 7, swap the word enable for disable.

Task Scheduler

Open the Network Connections window and you should notice the wireless connection disable itself when the Ethernet cable is inserted and vice versa. This worked flawlessly on our Dell laptops, but didn’t work on an older MSI laptop because it wouldn’t generate a specific event on connecting/disconnecting the Ethernet cable.

16 Comments - Write a Comment

  1. jimmyking 2 years ago
  2. steve 4 years ago
    • HAL9000 4 years ago
  3. David Whyte 7 years ago
  4. Paweł Szczeciński 7 years ago
  5. Eric 7 years ago
  6. jw 7 years ago
  7. Shivaraj Dalawai 8 years ago
  8. Chris 8 years ago
    • Evan Sullivan 8 years ago
  9. Getafix, the Druid 10 years ago
  10. beetlejuice 10 years ago
  11. beetlejuice 10 years ago
  12. musubi 10 years ago
    • SystemAccount 10 years ago
  13. V Vivekanand 12 years ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please contact us directly.