[ home | files | links | topics | stickers | about ]



Todays Stats

Visitors: 159
Referrers: 14
User Agents: 50
Pages Served: 514
 
Total Pages
Served:

4869443


Search


Modifying WLAN adapter status.
windows : by Corey - November 2nd 2009, 08:58PM
windows
Today I started a new job after being out of work for nearly five months. As a part of this job, I've been given a laptop and, like most companies these days, there are both wired and wireless access methods available for the company LAN.

While the access points are secured, the laptops issued to everyone utilize the Windows Wireless Zero Configuration Tool in Windows XP to manage access to the access points in the building. Because I am a task bar minimalist, the ever present icon and information dialogues that appear as a result of connection and disconnection to the access points drive me nuts.

Many current laptops have mechanical switches to enable or disable the WiFi adapter, but the model used by my company is considerably older and predates the widespread deployment of this feature. As such, heretofore, I've always gone into the adapter properties and disabled the WiFi adapter and then followed the same method to enable it the next time I needed it. This process takes two or three clicks and while not difficult, can become cumbersome if you find yourself doing it multiple times during the day.

While taking a break from reading the reams of documentation I've been given, I pondered the question of controlling the adapter hardware via batch script. Lo and behold, Microsoft has created a tool for this very purpose.

The tool is called Devcon and is free to use. It is a command line utility that essentially replaces the GUI Device Manager offered in Windows. There is extensive documentation on it but the important information is thus:

To affect change on a hardware device, you must know its device ID. Devcon provides a function for this called hwids:

c:\>devcon hwids "*" > c:\hardware.txt

This will create a list of all hardware devices currently recognized by Windows along with all pertinent details. In order to not have the information scroll outside the purview of my command session, I dumped it out to a file called hardware.txt.

When the hardware.txt file is opened, you'll see listings like this one for my WiFi adapter:

PCI\VEN_8086&DEV_4224&SUBSYS_10108086&REV_05\4&AD1B67F&0&10F0

   Name: Intel(R) PRO/Wireless 2915ABG Network Connection

  Hardware ID's:

PCI\VEN_8086&DEV_4224&SUBSYS_10108086&REV_05

PCI\VEN_8086&DEV_4224&SUBSYS_10108086
    PCI\VEN_8086&DEV_4224&CC_028000
    PCI\VEN_8086&DEV_4224&CC_0280

Compatible ID's:
    PCI\VEN_8086&DEV_4224&REV_05
    PCI\VEN_8086&DEV_4224
    PCI\VEN_8086&CC_028000
    PCI\VEN_8086&CC_0280
    PCI\VEN_8086
    PCI\CC_028000
    PCI\CC_0280>

The important thing to capture here is the device ID, which will be DEV_XXXX. So in the case of my WiFi adapter, it is DEV_4224.

The next step is to create batch files that have the enable and disable commands in them. You could setup a menu system to select the operation you would like to carry out but I think that defeats the purpose of single click automation. Create a batch file with the following command:

devcon disable *DEV_XXXX*

Obviously, to enable it is the same command utilizing enable instead of disable.

And it's just that simple. Devcon will print some text after the process is complete but launching a batch script with just that command it in will kill the command window as part of the cleanup process. I have both files in my custom quick launch menu and it works well.
Tweet|Google+|Facebook


tags: windows batch WLAN WiFi devcon





-+- neodux blog -+-
Page generated for 54.196.2.131 in 0.01785 seconds.
rss 2.0 feed