Before
getting into the nitty-gritties of this script, please consider the below
scenario.
An end user
connected to LAN and also the Wi-Fi is enabled.
What
determines which network adapter has more priority? We always think that when
LAN is enabled , the priority goes to LAN and all the traffic will be routed to
LAN interface rt?.
There are
two factors which determine this technically.
1. The network card which has got the
lowest metric value will have the highest precedence. (uncheck "Automatic
Metric" and set the interface metric to a number in advanced network
properties)
2. Machine will default to the network
card which has Network Adapter Binding Priority. ( This can be set manually
from the advance tab under network connections. )
Windows seems
to prefer the wired network if both connect at startup. However, if you later
connect a new interface (i.e., reconnect the wireless), it will take over the
default route.
Now consider
an user who is connected to WIFI network and comes back to ODC LAN. The network
connections which was active will still continue to work in WIFI rt? .
The problem
is that Windows won't force switch you to Wired after connecting because it
doesn't want to close your existing connections (which it would do if it forced
a switch). The best and most guaranteed way is to switch your wireless off
altogether
Now how about
a VB script which do exactly the same ? You just need to put it to start up and
just sit and watch your Wi-Fi card getting disabled when connected to LAN and
also getting re-enabled when disconnected from LAN.! ! !
Benefits?
·
Can always make
sure the traffic is through LAN whenever available.
·
Prevents too many
unwanted simultaneous connections to the access point. ( Seriously too many
redundant connections can be an overload for APs )
Usage- Save the attached file to local PC
and rename the extension as .vbs. Open CMD with admin and run as below.
C:\switcher.vbs
“Local Area Connection” “Wireless Connection”
The program
will not display anything, but run in the background looking for the change. It
will continue to run until the user logs out. If the Local Area Connection is
no longer connected, it will automatically enable the Wireless connection.
The reverse
is true…if Local Area Connection becomes available, it will automatically
disable the wireless connection.
The best
place to run the script would be from a group policy computer configuration
logon script (Not a user configuration) because it will run as local system and
have the proper permission to enable and disable network cards.
The attached
script is designed to work only on windows7\ windows 8.
References.
There are many third party apps which does exactly the same(
paid aps) . VB approach is free and easy to deploy. J
Dell and IBM laptops already have this feature enabled on
BIOS (LAN/WLAN Switching)
Please inbox me if someone need this VB script
ReplyDelete