Security Basics mailing list archives
RE: auto deactivate wlan upon lan connection(docking)
From: "Ramsdell, Scott" <Scott.Ramsdell () cellnethunt com>
Date: Fri, 11 Apr 2008 10:24:09 -0400
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 () securityfocus com [mailto:listbounce () securityfocus com] On Behalf Of sec () klevenberg org Sent: Friday, April 11, 2008 3:36 AM To: security-basics () securityfocus com 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
Attachment:
ReleaseWirelessAddresses.txt
Description: ReleaseWirelessAddresses.txt
Current thread:
- auto deactivate wlan upon lan connection(docking) sec (Apr 11)
- RE: auto deactivate wlan upon lan connection(docking) Wheeler, Eric (Apr 11)
- Re: auto deactivate wlan upon lan connection(docking) Gleb Paharenko (Apr 11)
- RE: auto deactivate wlan upon lan connection(docking) Ramsdell, Scott (Apr 11)