RE: auto deactivate wlan upon lan connection(docking)



You should be able to do this by creating a hardware profile.

Alternatively, here's VBS code that will do it:

' This script pings a server specified as the DHCP variable below. If
the ping is successful,
' the script will release DHCP leases for all wireless NICs. Users must
be local admins.

' Pick a server on your LAN and put its IP address in the field on line
11.


' Specify the local computer.
strComputer = "."

' Define the LAN DHCP server. Put your IP address within the quotes
substituting for the xxx's.
DHCP = "xxx.xxx.xxx.xxx"

' Connect to Windows management on the local computer.
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

' Collect a Ping response from the DHCP server on the LAN.
Set colPings = objWMI.ExecQuery("Select * From Win32_PingStatus where
Address = '" & DHCP & "'")

' If Ping was unsuccessful, do nothing. If successful, release wireless
IP.
For Each objStatus in colPings

If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then

Else

' Collect all of the NICs with IPs.
Set NICs = objWMI.ExecQuery("SELECT * FROM
Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each NIC in NICs

' Find wireless NIC(s) and release lease(es).
If InStr(NIC.Description, "ireless") > 0 Then

NIC.ReleaseDHCPLease()

End If

Next

End If

Next

WScript.Quit

The file is also attached. You will have to substitute a LAN IP to ping
in the script where indicated. This script doesn't disable the wireless
NIC, but will release the IP. You could likely tweak it a bit to do
exactly what you need, but this worked great for my needs.


Kind Regards,

Scott Ramsdell
CISSP CCNA MCSE


-----Original Message-----
From: listbounce@xxxxxxxxxxxxxxxxx [mailto:listbounce@xxxxxxxxxxxxxxxxx]
On Behalf Of sec@xxxxxxxxxxxxxx
Sent: Friday, April 11, 2008 3:36 AM
To: security-basics@xxxxxxxxxxxxxxxxx
Subject: auto deactivate wlan upon lan connection(docking)

Hi

Is there a way to make windows auto-disable wireless when lan is
connected?
I have tried policys and some registery checking and by using the
attached
software, without any luck..
Anyone have an idea of how to solve it?
Is there any software/freewares that might do the trick?


Cheers,
chaos


' This script pings a server specified as the DHCP variable below. If the ping is successful,
' the script will release DHCP leases for all wireless NICs. Users must be local admins.

' Pick a server on your LAN and put it's IP address in the field on line 11.


' Specify the local computer.
strComputer = "."

' Define the LAN DHCP server. Put your IP address within the quotes substituting for the xxx's.
DHCP = "xxx.xxx.xxx.xxx"

' Connect to Windows management on the local computer.
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

' Collect a Ping response from the DHCP server on the LAN.
Set colPings = objWMI.ExecQuery("Select * From Win32_PingStatus where Address = '" & DHCP & "'")

' If Ping was unsuccessful, do nothing. If successful, release wireless IP.
For Each objStatus in colPings

If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then

Else

' Collect all of the NICs with IPs.
Set NICs = objWMI.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
For Each NIC in NICs

' Find wireless NIC(s) and release lease(es).
If InStr(NIC.Description, "ireless") > 0 Then

NIC.ReleaseDHCPLease()

End If

Next

End If

Next

WScript.Quit


Relevant Pages

  • Re: DHCP Inside / Outside
    ... Two NICs can be "bridged" in WinXP or Windows 2003. ... RRAS DHCP relay agent (you said you turned RRAS ... Some weird effect of ISA (that I don't understand and ... DHCP is NOT coming from the interior DHCP server ...
    (microsoft.public.win2000.networking)
  • Re: does not match the existing scope error at install!!
    ... I always give a static IP to both NICs after the server portion has finished ... and before I continue with the rest of the SBS setup. ... This DHCP message is popping up before setup even finishes. ...
    (microsoft.public.windows.server.sbs)
  • Re: An error occured when configuring networking settings. See your network administrator." While tr
    ... The server is not enabled for DHCP so only the router is doing DHCP, ... so I have hard coded the DNS address from the server on the workstation NIC. ... LAN and WAN NICs on your SBS. ...
    (microsoft.public.windows.server.sbs)
  • Re: Help!! Web Server outage - ping failure
    ... :I have a Windows 2003 web server running IIS sitting behind a pix 506. ... Why would you allow ping responses from your router, ... Did you try the NICs in other ...
    (microsoft.public.inetserver.iis)
  • Re: How do I configure SBS 2003 as a DHCP server?
    ... The SpeedStream 6520 is indeed capable of handling PPPoE. ... to disable it's DHCP functionality, I have to disable all it's extra ... Ethernet adapter Server Local Area Connection: ... Two Nics, a dynamic IP address, ISA and a router ...
    (microsoft.public.windows.server.sbs)