# Solved: Disable Wireless



## computerman29642 (Dec 4, 2007)

I have a laptop that is connected to a network. When the laptop is connected to the network, I would like to have wireless disbaled. However, if I take the laptop off the network, I would like wireless to be re-enabled.

Is there a way to create a batch file or VBScript to do such a thing?


----------



## Squashman (Apr 4, 2003)

When you are connected to the LAN, it shouldn't matter if you are still connected to the Wireless. It will use the wired connection when you are connected to that and the Wireless when that is only available.

I don't think it is possible to do this with a VBscript or batch file but I could be wrong. At least not on XP. I believe it is possible with Vista because of the newer network stack they have for Vista.


----------



## TheOutcaste (Aug 8, 2007)

You can use the *devcon.exe* utility from Microsoft to do this:

*The DevCon command-line utility functions as an alternative to Device Manager*

Not sure if this works on Vista though.

You can also do this with Hardware Profiles, but you have to reboot to switch profiles.

Set one profile up with the Wireless Disabled in Device Manager and the Network Card Enabled, and one with the Wireless Enabled in Device Manager and the Network Card disabled.

*Control Panel | System*, *Hardware* Tab, *Hardware Profiles
*
HTH

Jerry


----------



## computerman29642 (Dec 4, 2007)

I could not get the Devcon command line to work. Have you ever used that command?


----------



## TheOutcaste (Aug 8, 2007)

One thing the help file doesn't mention is that you have to escape the ampersand (*&*) symbols in the Hardware IDs (HWID), otherwise cmd.exe will assume they are the start of a new command. Use the caret (*^*) for this, so use *^&* inplace of *&*:
So use for example:
devcon disable PCI\VEN_1011*^*&DEV_0009
devcon enable PCI\VEN_1011*^*&DEV_0009

This will disable and re-enable the Network adapter in a Microsoft Virtual PC, (or any PC with an Intel 21140-Based PCI Fast Ethernet Adapter)

devcon disable PCI\VEN_10B7*^*&DEV_9055
devcon enable PCI\VEN_10B7*^*&DEV_9055

This will disable and re-enable a 3Com 3C905B-TX NIC

For some reason when disabling the 3C905B the first time, Device Manager did not update it's display to show the red X, but Properties of the card did show that the card was disabled. In subsequent tests it did update it's display properly. But then that particular box is known for strange behavior at times. I think it's haunted

You should only need the VEN and DEV part of the HWID, unless you have multiple cards, then you would need to add (or just use by itself) the Instance ID.

Devcon help doesn't explain Instance ID either, so this article should help:
Device Identification Strings

HTH

Jerry


----------



## computerman29642 (Dec 4, 2007)

Thanks Jerry. I did not realize it was going to be this involved.


----------

