This should do it:
netsh interface set interface name="Local Area Connection" admin=disabled
Subsitute the actual network connection name if it isn't Local Area Connection.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi guys,
Anybody here who could point me to a resource or a command line instruction to disable a network interface in Windows 7? Your help would be highly appreciated. Thanks in advance!
Em
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
This should do it:
netsh interface set interface name="Local Area Connection" admin=disabled
Subsitute the actual network connection name if it isn't Local Area Connection.
You can use the following command to release the ip address of all the adapters. It will not disable any adapter, it will just disable the internet connectivity.
ipconfig /release
Re-enabling the internet
ipconfig /renew
Hope it helps...
Thanks EddieZA
With your post I was able to create a batch file that I can use to enable/disable my LAN and Wireless adapters individually or simultaneously.
The problem was that it had to be run with elevated privileges. So I created a shortcut to the batch file and used the "Run as administrator" option on the shortcut to run the batch file with the necessary elevated rights.
If anyone else might appreciate having this utility here's the batch file I'm using now...
@echo off
cls
goto Choices
REM use this command to determine what the adapter index number is
REM wmic nic get name, index
:Top
choice /c:123456
If ERRORLEVEL == 6 goto Enable_Wireless_Disable_LAN
If ERRORLEVEL == 5 goto Enable_LAN_Disable_Wireless
If ERRORLEVEL == 4 goto Disable_Wireless
If ERRORLEVEL == 3 goto Disable_LAN
If ERRORLEVEL == 2 goto Enable_Wireless
If ERRORLEVEL == 1 goto Enable_LAN
goto EOF
:1
:Enable_LAN
wmic path win32_networkadapter where index=9 call enable
goto :EOF
:2
:Enable_Wireless
wmic path win32_networkadapter where index=7 call enable
goto :EOF
:3
:Disable_LAN
wmic path win32_networkadapter where index=9 call disable
goto :EOF
:4
:Disable_Wireless
wmic path win32_networkadapter where index=7 call disable
goto :EOF
:5
:Enable_LAN_Disable_Wireless
wmic path win32_networkadapter where index=9 call enable
goto :4
:6
:Enable_Wireless_Disable_LAN
wmic path win32_networkadapter where index=7 call enable
goto :3
:Choices
echo 1 Enable LAN
echo 2 Enable Wireless
echo 3 Disable LAN
echo 4 Disable Wireless
echo 5 Enable LAN / Disable Wireless
echo 6 Enable Wireless / Disable LAN
goto Top
:EOF
this does not work for me
error of invalid method parameter
the 7 has to have the slash below it?
how do you get that
Start elevated Command Prompt.
Get NIC list and index number:
wmic nic get name, index
Enable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call enable
Disable NIC with index number: (eg: 7)
wmic path win32_networkadapter where index=7 call disable
This should work also with Windows 7 Home Premium 64bit, or only on 32bit versions?
Thanks.