Tuesday, September 4, 2012

Enabling/Disabling NIC via Command line

I recently found that I need for my system to be on multiple VLANs at different times.  Now, my NIC supports this and it is fairly easy to do in Windows 7, but I wanted to make it easier.  To accomplish this I wrote a little batch file that simply enables or disables the network interface card via wmic.

The NIC is configured with the following commands:

  • To determine the index value (##)
    • wmic nic get name, index
  • To Enable
    • wmic path win32_networkadapter where index=## call enable
  • To Disable
    • wmic path win32_networkadapter where index=## call disable

I then have the batch file with a choice statement that allows me to select the option I want.

I found the original information on how to accomplish this task here.

No comments:

Post a Comment