


netsh interface set interface "Local Area Connection" DISABLEDTo enable the interface run:
netsh interface set interface "Local Area Connection" ENABLEDIf the OS is Win XP the above method will probably not work. In that case, here is another (a little more complicated) option that works on XP using VB Script. If the interface is enabled this script will disable it, and it will enable it when it is disabled.
Const ssfCONTROLS = 3
sConnectionName = "Local Area Connection"
sEnableVerb = "En&able"
sDisableVerb = "Disa&ble"
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
set oNetConnections = nothing
for each folderitem in oControlPanel.items
if folderitem.name = "Network Connections" then
set oNetConnections = folderitem.getfolder: exit for
end if
next
if oNetConnections is nothing then
msgbox "Couldn't find 'Network Connections' folder"
wscript.quit
end if
set oLanConnection = nothing
for each folderitem in oNetConnections.items
if lcase(folderitem.name) = lcase(sConnectionName) then
set oLanConnection = folderitem: exit for
end if
next
if oLanConnection is nothing then
msgbox "Couldn't find '" & sConnectionName & "' item"
wscript.quit
end if
bEnabled = true
set oEnableVerb = nothing
set oDisableVerb = nothing
for each verb in oLanConnection.verbs
if verb.name = sEnableVerb then
set oEnableVerb = verb
bEnabled = false
end if
if verb.name = sDisableVerb then
set oDisableVerb = verb
end if
next
if bEnabled then
oDisableVerb.DoIt()
else
oEnableVerb.DoIt
end if
wscript.sleep 500 

But, I get this answer:
”
C:Users>netsh interface set interface “Local Area Connection” DISABLE
D
An interface with this name is not registered with the router.
”
Thanks for the help.
You might want to provide more details.
What is the OS ? (this method won’t work on XP)
Have you checked the interface names ? (ipconfig)
You need to actually specify your interface name, it could be called something else, see the output from my Windows machine:
d:Documents and SettingsUserDesktop>netsh interface show interface
Admin State State Type Interface Name
————————————————————————-
Enabled Dedicated Network Connect Adapter
Enabled Dedicated {32DAFD15-86C5-41C3-B398-EF8B4FA4
AAD4}
Enabled Dedicated {64D62236-302F-4DFA-81AD-19E82BB1
DB41}
Enabled Dedicated Wireless Network Connection
Enabled Dedicated Local Area Connection
Enabled Dedicated 1394 Connection
Enabled Internal Internal
Enabled Loopback Loopback
You can see the interface name in the last column.
You can also type simply netsh, then help to see all the commands available in the application.
My Windows machine is actually my work PC and it is running XP SP2. As Carlosdl mentioned if you are still having problems then please specify your exact OS.
Mattmather, have you tested it on your xp machine ?
I remember that NETSH can’t modify the status of the network interfaces in XP as the OS sees them as “dedicated”.
I have used it in the past but not tested on this machine as I am using it. A little google has confirmed an issue as mentioned in .
An alternative suggestion could be to use wmic and there is a pretty darn good demo here:
This links should have been MS Support and the alternative at Using wmic
Are there any changes that I need to make? Because, when I run this command, it is fail to disable the LAN…
Any further explanation??
Thank you…
Powerofnetworking, what command are you referring to ?
As you can see, at least three options have been mentioned in the answer and discussions.
From your latest answer…
So you are using the VB script, right ?
Are you getting errors ? if so, what is the complete error message ?
Please, help us help you.
Do you mean that I need to download and install the VBScript first?
After that, only run the batch file that u provided??
Thanks a lot…
This is why I asked about the command you were referring to. And it seems that “your last answer” meant different things for you and for me.
You have to understand that we don’t know what you are doing, and we don’t know the exact results you are getting, and we know nothing about the machine you are doing this on. If you don’t provide more information, we won’t be able to help you.
In the ‘answer’ section I posted a vb script (which I presented as an alternative since the netsh option wouldn’t work on windows xp, although we still don’t know the operating system involved).
If you want to use that option, you just have to create a text file with ‘.vbs’ extension and put the provided script text in there. After saving the file you would only need to double click on it to execute the script.
I have got the same error of “Powerofnetworking” (An interface with this name is not registered with the router).
My solution was right click on my “.bat” and choose “Run as Administrator”. Ha, my SO is Windows 7 x86 Ultimate.
Thanks to you all!
for vbs, work great in win xp. thanks,