Skip to main content
PowershellWindows

How to Automatically Turn Off Wi-Fi When an Ethernet Cable is Connected?

By July 31, 2019October 30th, 2019No Comments

If several Wi-Fi networks are available, Windows 10 automatically selects a wireless network with the strongest signal (no matter what the speed of this connection is and how many devices are connected to it). However, when you connect your computer (laptop) to a wired Ethernet network, Windows keeps on using Wi-Fi network, though Ethernet connection speed is significantly higher, and the connection is more stable and not subject to interference. To switch to the cable Ethernet connection, a Windows user has to manually disable the Wi-Fi connection each time. Let’s consider how to automatically turn off Wi-Fi when the Ethernet LAN cable is connected.Contents:

WLAN Switching Options in the BIOS/UEFI

Many computer vendors have their own implementations of the LAN/WLAN Switching technology (they can be named differently). This technology suggests that on a user computer only one network adapter can simultaneously transmit data. If while using a Wi-Fi network, a higher priority Ethernet connection appears on a device, the Wi-Fi adapter should automatically go into the standby mode. Thus, the battery resource is saved and the wireless Wi-Fi network load is reduced.

You can enable LAN/WLAN Switching option in the BIOS/UEFI settings or in the properties of your wireless network adapter driver (it depends on your hardware manufacturer).

Restart your computer to enter the UEFI/BIOS settings, then find and enable the LAN/WLAN Switching option (on HP devices) or Wireless Radio Control (on Dell devices).

enable LAN/WLAN Switching in BIOS

This feature may be called differently or be absent in BIOS/UEFI from other manufacturers.

“Disable Upon Wired Connect” in the Wi-Fi Adapter Properties

In the settings of some Wi-Fi adapter drivers, there is an option to automatically turn off the Wi-Fi if the high speed Ethernet connection is available.

Open the Network and Sharing Center in Windows 10 and open the properties of your Wi-Fi adapter. Click Configure.

wireless network adapter properties

In the network adapter properties go to the Advanced tab and find the Disabled Upon Wired Connect item in the list of Wi-Fi adapter options. Change its value to Enabled and save the changes.

Disabled Upon Wired Connect - 802.11n wireless adapter option

Due to this option, the driver will be disconnected from a Wi-Fi network if an active Ethernet connection is detected.

This option is not supported on all models of Wi-Fi card drivers. If you don’t have one, the automatic switch to Ethernet connection can still be implemented using a PowerShell script.

Use PowerShell to Disable Wi-Fi when an Ethernet Connection Exists

To automatically enable or disable the WLAN adapter, you can write your own script and make it trigger at the event of the link appearing on the wired LAN interface (Event-ID: 32 — Network link is established) and (Event-ID: 27 – Network link is disconnected) using event triggers, but there is a ready solution for PowerShell.

To automatically turn off the Wi-Fi adapter when a computer is connected to a wired Ethernet network, you can use a ready PowerShell script — WLAN Manager (the original version is available here: https://gallery.technet.microsoft.com/scriptcenter/WLAN-Manager-f438a4d7). You can find a newer WLAN Manager version with enhanced Windows 10 support and correct detection of virtual adapters on GitHub: https://github.com/jchristens/Install-WLANManager.

This PowerShell script creates a new Scheduler task that runs another script at the system boot. The script regularly checks for active network adapters. If the script detects any LAN (Ethernet) connection, WLAN interface is automatically disabled. If the Ethernet network cable is disconnected, the script enables the wireless Wi-Fi adapter.

The script consists of 2 files:

  • PSModule-WLANManager.psm1
  • WLANManager.ps1

Let’s see how to install WLAN Manager script in Windows 10. Open the elevated PowerShell prompt and allow to run the PS1 scripts:

Set-ExecutionPolicy RemoteSigned

Install the script in your system using the following command:

.\WLANManager.ps1 -Install:System

The script may be installed to be run as from a user account (Install:User) or as a local system (Install:System).

installing WLANManager powershell script

Verifying WLAN Manager version information… Missing
Writing WLAN Manager version information… Done
Verify WLAN Manager Files… Missing
Installing WLAN Manager Files… Done
Verify WLAN Manager Scheduled Task… Missing
Installing WLAN Manager Scheduled Task… Done

You can make the script notify a user when switching between Wi-Fi and LAN networks:

.\WLANManager.ps1 -Install:User -BalloonTip:$true

Make sure that a new WLAN Manager task has appeared in the Task Scheduler.

WLAN Manager task in windows 10

Restart your computer. After the startup, the Scheduler will start the C:\Program Files\WLANManager\WLANManager.ps1 script that checks network connections every second, and if a LAN connection is detected, all available Wi-Fi adapters will be disabled. If the LAN cable is disconnected, the script will automatically enable wireless Wi-Fi adapters.

WLAN Manager script works well on Windows 10, Windows 8.1 and 7.Tip. To remove the WLAN Manager script, run this command:

.\WLANManager.ps1 Remove:System

GPO to Disable Non-Domain Wireless Networks When Connected to LAN

In the GPO there are a separate setting that allows you to disable the Wi-Fi connections when a computer is connected to a corporate domain network via LAN. This policy is located in the GPO section Computer Configuration -> Policies ->Administrative Templates -> Network ->Windows Connection Manager and called “Prohibit connection to non-domain networks when connected to domain authenticated network”. The policy appeared in Windows 8 / Windows Server 2012 or higher.

The policy prevents a computer from being connected to both domain and non-domain networks at once.

gpo: Prohibit connection to non-domain networks when connected to domain authenticated network

However, if this policy is enabled, you may experience some problems when connecting to a Wi-Fi network if the additional interfaces are present on your computer (for example, loopback or virtualization software created).

Leave a Reply