enabling and disabling your network card using command line


there are two good third party softwares i found to do the job… but first:
purpose, why i need to enable disable network card?
in my case i have this complex computer arrangement that one computer has two connection, one to LAN A one to LAN B, LAN A and B is not connected they have different PDC, and the access time is different, LAN A is for day time, while LAN B is for night time.

now what are the two softwares?
first is the simplest one, ToggleNic, it really simple you just need to use the name of the NIC. for example:
ToggleNic.exe “Local Area Connection”
this will enable the connection of “Local Area COnnection”
while:
ToggleNic.exe “Local Area Connection” disable
will disable it.

what is the bad thing about it? it will only work for xp, so you can use it to w2k below…
now this second software can work for w2k, but the real purpose of the software is not just to enable disable NIC, but wider than that, it is to act as the “command line version of the device manager”
and the command line is not using device name but the hardware id, which is mostly gibberish, but fortunately we can use wild card for the name identification, so we don’t need to type all the gibberish hardware id… the syntax is like this:
first you need to find the hardware id of your device, in xp you can easily find it but in w2k you can’t see it unless it is a troubled device (the yellow question mark in device manager). so how to do it? just type:

devcon find *

it will list all the hardware installed in your computer, look for network card…

after you found the right NIC hardware id, you can use:

devcon.exe disable [hardware id]

the [hardware id] can use wildcard, but remember if the wildcards matches more than one device then all that devices that match the wildcard will be disable, so be careful!

so instead typing:

devcon disable PCIVEN_8086&DEV_1229&SUBSYS_005C1014

you can type:

devcon.exe disable PCIVEN_8086*

now what happened when you have similiar NIC? it mush have the same id…

PCIVEN_8086&DEV_1229&SUBSYS_005C1014&REV_024&10010000&0&48F0

PCIVEN_8086&DEV_1229&SUBSYS_005C1014&REV_024&10011000&0&48F0

like you see above, the hw id is the same but the tail is different, so can we use this:
devcon.exe disable PCIVEN_8086&DEV_1229&SUBSYS_005C1014&REV_024&10010000&0&48F0

no you can’t because the tail is the class id, not the hardware id

so instead you use this command:

devcon.exe disable @PCI**10010000*

this way, you’ll only disable one NIC not both

Advertisements

One thought on “enabling and disabling your network card using command line

  1. msvish says:

    Thank you! it’s working!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s