Enable/Disable Wi-Fi Adapter based on Wired adapter status

There are plenty of articles around the Internet discussing how to enable or disable a Wi-Fi adapter based on the status of the wired connection. Whilst I’ve seen that some Dell laptops have this as a simple option in BIOS, our Lenovo machines do not, so this post describes how I achieved a workable solution.

Most modern NIC drivers log an event to the System log when a link is established or disconnected:

2015-07-07 13_59_29

This means that it’s possible to create a scheduled task with triggers to look for those specific events, and run a script to enable or disable the wireless adapter.

Some people set up multiple tasks, and multiple scripts, to enable/disable the adapter, but I found it easier to create a single script that runs whenever any of these events occur:

  1. e1dexpress and e1cexpress – Event ID 32 (Link established)
  2. e1dexpress and e1cexpress – Event ID 27 (Link disconnected)
  3. On workstation unlock (useful if the computer is put to sleep, and then un-docked)
  4. At system startup

Note that the script may not work out-of-the-box if you don’t have a NIC that’s driven by one of the above drivers.

I currently push the script and the scheduled task configuration out using Group Policy Preferences.

Note that this script depends on the network adapters having their default names as per Windows 8.x’s naming. Also, PowerShell 4.0 is required, as the script makes use of the newer *-NetAdapter cmdlets.

2 thoughts on “Enable/Disable Wi-Fi Adapter based on Wired adapter status

  1. Hi ,

    How do i identify event id for cellular in windows 10 if it goes down or up ? and is there any ways to switch to WIFI whenever my Cellular goes down ?


    • Hi,

      It really depends on the hardware and drivers in use. Perhaps the cellular adapter doesn’t log any information. Or, you may need to enable a specific event log that’s disabled by default.

      Sorry if that’s not much help…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s