Windows OS Hub
  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Group Policies
  • Windows Clients
    • Windows 10
    • Windows 8
    • Windows 7
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
  • PowerShell
  • Exchange

 Windows OS Hub / Windows 10 / How to Automatically Turn Off Wi-Fi When an Ethernet Cable is Connected?

May 14, 2019 PowerShellWindows 10

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

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
  • “Disable Upon Wired Connect” in the Wi-Fi Adapter Properties
  • Use PowerShell to Disable Wi-Fi when an Ethernet Connection Exists
  • GPO to Disable Non-Domain Wireless Networks When Connected to LAN

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).

4 comments
0
Facebook Twitter Google + Pinterest
previous post
Windows Server Licensing for Virtual Environments
next post
Fix: “Signature” Button Not Working in Outlook 2013/2016

Related Reading

How to Sign a PowerShell Script (PS1) with...

February 25, 2021

How to Shadow (Remote Control) a User’s RDP...

February 22, 2021

Configuring PowerShell Script Execution Policy

February 18, 2021

Configuring Proxy Settings on Windows Using Group Policy...

February 17, 2021

Updating Group Policy Settings on Windows Domain Computers

February 16, 2021

4 comments

Joseph January 28, 2020 - 3:33 am

I trade the stock market and have a question. If I use a UPS and a wired internet connection and I have a power outage therefore losing the wired internet, will this procedure work to automatically connect to my hotspot wireless phone connection? This way I can manage my trading account before the computer shuts down.

Reply
admin January 28, 2020 - 5:17 am

You can use the WLAN Manager PowerShell script if during a power outage, your Ethernet connection status changes to disconnected. But in this case, your phone hotspot should be turned on constantly.

Reply
Steve July 8, 2020 - 9:58 am

Can someone give a more in depth guide as to how to setup WLAN ? Some of the terminology is confusing…

I think the first script creates a scheduled task, the second is used as an action , but what is the trigger, need some help,please

Reply
Michel Hesse December 11, 2020 - 1:00 pm

Hi Steve, the Trigger is the Event ID in the Eventlog
(Event-ID: 32 — Network link is established) and (Event-ID: 27 – Network link is disconnected)

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange
  • Windows 10
  • Windows 8
  • Windows 7
  • Windows Server 2016
  • Windows Server 2012 R2
  • Windows Server 2008 R2
  • PowerShell
  • VMWare
  • MS Office

Recent Posts

  • How to Sign a PowerShell Script (PS1) with a Code Signing Certificate?

    February 25, 2021
  • Change the Default Port Number (TCP/1433) for a MS SQL Server Instance

    February 24, 2021
  • How to Shadow (Remote Control) a User’s RDP session on RDS Windows Server 2016/2019?

    February 22, 2021
  • Configuring PowerShell Script Execution Policy

    February 18, 2021
  • Configuring Proxy Settings on Windows Using Group Policy Preferences

    February 17, 2021
  • Updating Group Policy Settings on Windows Domain Computers

    February 16, 2021
  • Managing Administrative Shares (Admin$, IPC$, C$, D$) in Windows 10

    February 11, 2021
  • Packet Monitor (PktMon) – Built-in Packet Sniffer in Windows 10

    February 10, 2021
  • Fixing “Winload.efi is Missing or Contains Errors” in Windows 10

    February 5, 2021
  • How to Move (Clone) Windows to a New Hard Drive (HDD/SSD)?

    February 4, 2021

Follow us

woshub.com
  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Install RSAT Feature on Demand on Windows 10 1809 and Later
  • Get-ADUser: Getting Active Directory Users Info via PowerShell
  • How to Create a UEFI Bootable USB Drive to Install Windows 10 or 7?
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • Get-ADComputer: Find Computer Details in Active Directory with PowerShell
  • How to Find the Source of Account Lockouts in Active Directory domain?
  • PSWindowsUpdate: Managing Windows Updates from PowerShell
Footer Logo

@2014 - 2018 - Windows OS Hub. All about operating systems for sysadmins


Back To Top