Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

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

5 comments
1
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

Create Organizational Units (OU) Structure in Active Directory...

May 17, 2022

Windows Security Won’t Open or Shows a Blank...

May 17, 2022

How to Manually Install Windows Updates from CAB...

May 16, 2022

RDS and RemoteApp Performance Issues on Windows Server...

May 16, 2022

Enable or Disable MFA for Users in Azure/Microsoft...

April 27, 2022

5 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
Oregon P September 10, 2021 - 1:06 am

Hi , The script installed fine on my laptop but noticed an issue after installing it, if the user is in VPN (working from home) then the schedule task keeps on disconnecting the system from the WiFi network, by any chance would it be possible to include a VPN check so that when the user is connected to VPN from home the network stays connected.

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows 7
  • Windows Server 2019
  • Windows Server 2016
  • Windows Server 2012 R2
  • PowerShell
  • VMWare
  • Hyper-V
  • MS Office

Recent Posts

  • Create Organizational Units (OU) Structure in Active Directory with PowerShell

    May 17, 2022
  • Windows Security Won’t Open or Shows a Blank Screen on Windows 10/ 11

    May 17, 2022
  • How to Manually Install Windows Updates from CAB and MSU Files?

    May 16, 2022
  • RDS and RemoteApp Performance Issues on Windows Server 2019/2016

    May 16, 2022
  • Deploying Software (MSI Packages) Using Group Policy

    May 12, 2022
  • Updating VMware ESXi Host from the Command Line

    May 11, 2022
  • Enable or Disable MFA for Users in Azure/Microsoft 365

    April 27, 2022
  • Fix: You’ll Need a New App to Open This Windows Defender Link

    April 27, 2022
  • How to Reset an Active Directory User Password with PowerShell and ADUC?

    April 27, 2022
  • How to Completely Uninstall Previous Versions of Office with Removal Scripts?

    April 26, 2022

Follow us

woshub.com

ad

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • How to Find the Source of Account Lockouts in Active Directory domain?
  • Get-ADComputer: Find Computer Details in Active Directory with PowerShell
  • How to Create a UEFI Bootable USB Drive to Install Windows 10 or 7?
  • Adding Third-Party Drivers into VMWare ESXi 6.7 ISO Image
  • Managing Printers and Drivers with PowerShell in Windows 10 / Server 2016
  • How to Delete Old User Profiles Using GPO and PowerShell?
  • Managing User Photos in Active Directory Using ThumbnailPhoto Attribute
Footer Logo

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


Back To Top