Share via


Switching between Ethernet and wifi

Question

Monday, August 17, 2015 1:55 PM

Hi,

I have a question regarding networking.  When I dock my Surface pro 3 the WiFi stays connected.  The surface though begins to use the Ethernet connection automatically.  Is there any way of disconnecting the WiFi once a computer switches to the network?  Its a question raised by our security team for compliance reasons.

Thanks.

All replies (6)

Wednesday, August 19, 2015 3:57 PM ✅Answered | 1 vote

Hi solution I used was as follows.  Minimum Powershell 3.0 required.

First of all grab a list of your NICs:

Get-NetAdapter | Format-Table Name, InterfaceDescription -Auto

To disable wifi when the computer is connecting to WLAN, create a basic scheduled task  using the options below for when an event is logged:

Log: Microsoft-Windows-NetworkProfile / Operational

Source: NetworkProfile

Event ID: 10000

This is basically the WLAN becoming operational.  From Conditions tab select netowork.  Start only if the following network is available E.g. contoso.local.

Then from actions, run a program.  Which is the following Powershell script.

Disable-NetAdapter -Name 'Wi-Fi' -confirm:$False

Save the scheduled task as a local administrator not domain admin account.  Set the script to run whether logged in or not.  Set to run as your preferred Windows flavour, in this case 10.

To Enable WiFi when the Surface becomes un-docked from WLAN this is the second task trigged.  This is basically the network going offline.

Log: Microsoft-Windows-NetworkProfile/Operational

Source: NetworkProfile

Event ID: 10001

From Actions run the Powershell command

Enable-NetAdapter -Name 'Wi-Fi' -confirm:$False

If you wanted to be become really strict you can add a second line to each PS script which disables and enables the ethernet so only one network connection is available at any one time LAN or WiFi.  This essentially prevents the bridging scenario.

If you have to faff around with signing scripts you can call the Powershell script from a batch file which bypasses the security.  Point the task to the batch file rather than the ps1 script.

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File “C:\windows\system32\disable_wifi.ps1"

M.


Tuesday, August 18, 2015 8:40 AM

Hi MattRW,

Based on what I know, there seems to be no option available in Windows 10 to switch off WIFI when Ethernet connected.

WhICH I consider might work is to run a script monitoring the status of the network adapter, once connected, then disconnect the WIFI with another script. I am not good at scripts, we may consider seek help at some scripting forum and see what if experts there would have any better suggestions.

Regards

Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].


Thursday, August 20, 2015 2:31 AM

Hi MattRW,

Thank you for your update and sharing!

Hope the information here would help the others who mght encounter the same situation.

Regards

Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected].


Thursday, August 20, 2015 6:20 AM

seems to be no option available in Windows 10 to switch off WIFI when Ethernet connected.

Airplane mode?  However, something weird I noted about that on another thread, it seems I can use WIFI then too?  I thought that is what Airplane mode was for. 

I just had another look.  In my Action Center (swipe from right) I have Airplane mode on and a wireless connection showing.  E.g. Wi-Fi is not showing there but what is showing is an active Wi-Fi connection.

Robert Aldwinckle


Thursday, August 20, 2015 8:40 AM

The idea is the user does nothing, and that it seamless switching between wifi and the LAN.


Thursday, August 20, 2015 3:02 PM

The idea is the user does nothing

I'd still check to see if that is set.  FWIW it has been reported after updates and I saw it ("invalid" Airplane mode) set myself once (after an update).  I never considered that it might be "by design" somehow.  So perhaps what really matters is whether network discovery needs to be done?  Who knows?  No source + no support documentation + inferences made by observations = speculation.  Then I would try using netsh trace but I don't know which one would be appropriate.  netsh wlan reportissues  has always been an intriguing possibility for me but so far I have not bothered investigating how to use it.  This incident might be sufficient stimulus.   ; )

Robert Aldwinckle