Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • 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 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 Disable Wi-Fi When Ethernet is Connected

June 8, 2023 PowerShellWindows 10Windows 11

How to Automatically Disable Wi-Fi When Ethernet is Connected

If several Wi-Fi networks are available, Windows automatically selects a wireless network with better signal strength (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 a Wi-Fi network, though the 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 see how to automatically turn off Wi-Fi when the Ethernet LAN cable is connected on Windows 10 and 11.

Contents:
  • WLAN Switching Options in BIOS/UEFI
  • Disable Wi-Fi Upon Wired Connect with Wireless Adapter Driver
  • Enable/Disable Wi-Fi Adapter When Connected to LAN with Task Scheduler
  • Turn Off Wi-Fi on Ethernet Connection Using WLAN Manager PowerShell Script
  • Disable Non-Domain Wireless Networks When Connected to LAN via GPO

WLAN Switching Options in BIOS/UEFI

Many laptop/desktop vendors have their own implementations of the LAN/WLAN Switching technology (it can be called differently). This technology suggests that only one network adapter can simultaneously transmit data on a computer. If while using a Wi-Fi network, a higher priority Ethernet connection appears on a device, the Wi-Fi adapter should automatically go into standby mode. This saves battery life and reduces the load on the wireless network.

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

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 completely absent in BIOS/UEFI of other manufacturers.

Disable Wi-Fi Upon Wired Connect with Wireless Adapter Driver

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 Windows Device Manager (devmgmt.msc), find your Wireless network adapter in the Network adapters section and open its properties. Go to the Advanced tab.

Find the Disabled Upon Wired Connect item in the list of Wi-Fi adapter options. Change its value to Enabled and save the driver changes.

Disabled Upon Wired Connect - 802.11n wireless adapter option

Thanks to this option, the wireless network driver will disconnect the adapter from the Wi-Fi network when an active Ethernet LAN connection is detected.

Not all Wi-Fi adapter models support this option. For other wireless network adapters, you can automate switching to Ethernet using a scheduler task or a PowerShell script.

Enable/Disable Wi-Fi Adapter When Connected to LAN with Task Scheduler

Let’s look at how to automatically enable and disable Wi-Fi adapters in Windows using special Task Scheduler jobs that are bound to an Ethernet cable connection/disconnection event ( we will use Windows Scheduler event trigger).

The first step is to enable the Wired AutoConfig service (dot3svc) and set it to start automatically. You can check the status of a service and change the startup mode using PowerShell:

Set-Service dot3svc -startuptype automatic -passthru
Start-Service dot3svc
Get-Service dot3svc

Enable Wired-AutoConfig service (dot3svc) in Windows

Now open the Event Viewer (eventvwr.msc) and go to Applications and Services Logs -> Windows -> Wired-AutoConfig -> Operational. Here we are interested in two following events:

  • Event ID 15501 — The network adapter has been connected.
  • Event ID 15500 — The network adapter has been unplugged.

Wired-AutoConfig Event ID 15500: The network adapter has been unplugged

In previous versions of Windows, you need to use other IDs for the LAN link connection events (EventID: 32 — Network link is established ) and ( EventID: 27 – Network link is disconnected ).

We will bind PowerShell commands to these events in order to enable and disable the Wi-Fi adapter automatically. To do this, you need to get the name of your Wi-Fi network adapter in Windows. You can list network adapters with PowerShell:

Get-NetAdapter

In our example, the adapter name is TPLinkWiFi.

get network adapter name in Windows

Click on event 15501 in the Event Viewer and select Attach task to this event.

attach task to event in event viewer

Specify the scheduler task name DisableWiFi_if_Ethernet_Connected-15501. Select Start a program as the task action. To disable the Wi-Fi adapter, you need to run the following command:

Program: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

Add arguments: -NoProfile -WindowStyle hidden -ExecutionPolicy Bypass -Command &{Disable-NetAdapter -Name TPLinkWiFi -confirm:$False}

windows task: enable wifi adapter

Create another scheduler task for Event ID 15500 in the same way.

  1. Set the task name: EnableWiFi_if_Ethernet_Disconnected-15500
  2. Configure the task action:
    Command: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Argument: -NoProfile -WindowStyle hidden -ExecutionPolicy Bypass -Command &{Enable-NetAdapter -Name TPLinkWiFi -confirm:$False}

In the properties of both tasks, go to the Conditions tab and uncheck the Start the task only if the computer is on AC Power option.

disable power dependencies in task properties

Now try to connect the LAN cable. After a couple of seconds, your Wi-Fi adapter will be automatically disabled (Status=Dormant).

turn off wifi when ethernet cable connected via task scheduler

When Ethernet is disconnected, the task enables the wireless adapter and Windows automatically connects to your saved Wi-Fi network.

Turn Off Wi-Fi on Ethernet Connection Using WLAN Manager PowerShell Script

To automatically disconnect the Wi-Fi adapter when a computer is connected to a wired Ethernet network, you can use the WLAN Manager PowerShell script. 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 will create a new Scheduler task that periodically checks for active network adapters. If the script detects any LAN (Ethernet) connection, the WLAN interface is automatically disabled. If the Ethernet network cable is disconnected, the script enables the wireless Wi-Fi adapter.

The script consists of two files:

  • PSModule-WLANManager.psm1
  • WLANManager.ps1

You can install WLAN Manager script on Windows. Open the elevated PowerShell prompt and allow to run the PS1 scripts:

Set-ExecutionPolicy RemoteSigned

Install the script on Windows with the following command:

.\WLANManager.ps1 -Install:System

The script may be installed to run as a user account (Install:User) or with a local system account priveleges (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 with a pop-up notification 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 11, 10, 8.1, and 7.

Tip. To remove the WLAN Manager script, run this command:

.\WLANManager.ps1 Remove:System

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

There is a separate setting in GPO 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 following 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 prevents computers from connecting to both a domain network and an untrusted non-domain network at the same time.

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

However, when this policy is enabled, you may experience problems when connecting to a Wi-Fi network if the additional interfaces are present on your computer. For example, loopback interface or virtual network adapters from desktop hypervisors (VMware Workstation, Hyper-V, VirtualBox, etc.)

You can also disable the use of Wi-Fi if there is an active Ethernet connection to the domain LAN. You can configure this behavior using the GPO option Minimize the number of simultaneous connections to the Internet or a Windows Domain under Computer Configuration -> Administrative Templates -> Network -> Windows Connection Manager. Enable the policy and select 3=Prevent Wi-Fi when on Ethernet.

gpo: prevent wi-fi on ethernet

6 comments
4
Facebook Twitter Google + Pinterest
previous post
How to Restore Deleted EFI System Partition in Windows
next post
Fix: Saved RDP Credentials Didn’t Work on Windows

Related Reading

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

October 15, 2023

How to Query and Change Teams User Presence...

October 8, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

6 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
Admire January 30, 2023 - 2:09 pm

Good day, thank you for this tip. May I know if Wi-Fi is automatically disabled because Ethernet is active, won’t this affect the Hotspot option as it needs to share Ethernet internet via Wi-Fi?

Reply

Leave a Comment Cancel Reply

Categories

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

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Configuring Port Forwarding in Windows
  • How to Install Remote Server Administration Tools (RSAT) on Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Delete Old User Profiles in Windows
  • Get-ADUser: Find Active Directory User Info with PowerShell
Footer Logo

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


Back To Top