If you want to disable LAN connection from Windows command prompt, you can run the following steps.
- Open elevated command prompt
- Run the below command
netsh interface set interface name="Local Area Connection" admin=DISABLED
That’s all you need to do. Now you may open ‘Network connections’ and confirm that the connection is disabled.
You can also use netsh command to check the connection status.
C:\>netsh interface show interface Admin State State Type Interface Name ------------------------------------------------------------------------- Disabled Disconnected Dedicated Local Area Connection 2 Enabled Connected Dedicated Wireless Network Connection Disabled Disconnected Dedicated Local Area Connection
The output for the above netsh command shows that LAN connection is turned off.
how to enable it?
Replace disabled by enabled…
This trick only worked when I opened the command prompt “Run as Administrator”
Correct, It will only work within an elevated command prompt. Just as if a limited user was in the network connections menu they would not be able to disable the lan without administrative privileges which is why it escalates with uac.
how i do it without admins privileges??? is even possible?
I could never get this to work. The command goes through without showing an error (maybe there’s something in Event Viewer, but I never looked), but in my experience, the NIC remains enabled.
I ended up using a WMIC command from another site.
If you’re stuck during Windows setup you can press Shift+F10 to bring up the command prompt and use this to avoid creating a Microsoft account.
thank you, but what about Domain users?
We can use this command for Windows 7 8 10
set interface name=”Wired Ethernet Connection” admin=DISABLED
i wanna add this to a notepad ( Bat file) and execute it but it not working, any ideas? as i have to switch between Lan and wifi all the time.
C:\Windows\system32>netsh interface set interface name=”Ethernet” admin=DISABLED
run as administrator