Disable Local Area Connection from Command line


Recommended Posts

Hello Everyone,

I want to disable and enable my network connection using a script.

On my XP I had an icon that did a:

netshx Disable "Local Area Connection"

This still works on my new Windows 7 but now the UAC pops up when I run the icon.

When I disable/enable the network card from Device Manager the UAC don't pop up.

I've tried:

netsh interface set interface "Local Area Connection" DISABLE

But received this error:

An interface with this name is not registered with the router.

So, is there a command line to disable the network card without the UAC popping up?

Acakuo

netshx is not a windows builtin command -- its a script someone put together that uses devcon to control hardware

http://www.novell.com/communities/node/233...nd-line-control

run your netshx command from an elevated command prompt.

You use to only be able to enable disable wireless, but from a elevated prompt this command works on 7 for wired interfaces.

Netsh interface set interface "Local Area Connection" enable

Netsh interface set interface "Local Area Connection" disable

Or whatever you have your interface called.

"An interface with this name is not registered with the router."

You get that error because you ran it from a non admin prompt. You need to run such a command from an elevated command prompt.

post-14624-1258985812_thumb.png

Edited by BudMan

Thanks allot,

The netshx does work when I use the CMD as administrator. But I'm back with the UAC windows?

It looks like I will use the "IPCONFIG /RELEASE" and "/RENEW" this does the trick of disabling the network connection without the UAC popping up.

With this method I don?t get any visual icon to see that the net is disconnected, but it's seems to be the best that I can get on 7.

Acakuo

using the actual netsh command does not pop up a UAC prompt. and disables the interface.. Like I said netshx is not a command -- its a script that uses devcon.

sorry I meant netsh in my replay...

How can you use the netsh with out the UAC prompt?

I've made a bat file with the line "Netsh interface set interface "Local Area Connection" disable" in it.

1. normal run will no nothing.

2. right click -> run as admin will pop the UAC and then disable the network.

3. the properties -> compatibility is grayed out, so i used This but still it does nothing.

What am i missing?

Acakuo

Like I said run from an admin prompt -- and you get no popup.

post-14624-1259016356_thumb.png

You get the prompt when you you run the console as admin -- but once your in as admin running the command does not pop it up again.

So now your question is how to run a batch file as admin without a UAC prompt -- hmmmm, off the top of my head not sure how to do that - would have to look it up.. Not something you should be doing normally.

Here you go this should work for you

http://www.winhelponline.com/blog/run-prog...the-uac-prompt/

How to Run Programs Elevated Without Getting the UAC Prompt

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • When I was a teen, I actually believed that the government used to be always be the bad guy. However as an adult, someone who has actually seen the Law work (though not perfect). I now think everyone cries a river. In this specific case, the so called freedom has consequences to society. Anyone who has seen how child are indeed affected, and I don't mean only extreme things like getting drugs or hate crimen , but no one can deny society as a whole has gone down a rabbit hole due to exesive use of internet. Before anyone calls out that it's the parents responsibility. Yes that's true, but the reality your family/kids might be good people. There are 99% out there who are not and have been brain dead by many things on the internet.
    • Siri AI : iPhone Air, iPhone 17 Pro iPad with M4 and later with 12GB or more in memory Mac with M3 and later with 12GB or more in memory
    • Siri AI will only work locally on these new machines. Not great iPhone Air, iPhone 17 Pro iPad with M4 and later with 12GB or more in memory Mac with M3 and later with 12GB or more in memory
    • Universal Media Server 15.6.0 by Razvan Serea Universal Media Server is a DLNA-compliant UPnP Media Server. UMS was started by SubJunk, an official developer of PMS, in order to ensure greater stability and file-compatibility. The program streams or transcodes many different media formats with little or no configuration. It is powered by MEncoder, FFmpeg, tsMuxeR, AviSynth, MediaInfo and more, which combine to offer support for a wide range of media formats. Because it is written in Java, Universal Media Server supports all major operating systems, with versions for Windows, Linux and Mac OS X. To see a comparison of popular media servers, click here. Universal Media Server 15.6.0 changelog: General Added Discogs integration for audio metadata and UPnP Added new options for DNS resolution handling (thanks, @henry701 Henrique Campos!) Added a loading indicator to the Shared Content area on the web settings (#6037) Improved detection of sample videos Improved stability of speed test (thanks, @henry701 Henrique Campos!) Fixed support for servers with no Internet access (#6047) (thanks, @henry701 Henrique Campos!) Fixed wrong Linux yt-dlp binary being packaged (#6011) (thanks, @Pro-pra!) Fixed API lookups happening for TV series when episode lookup fails, even if the series metadata is already in the local database (#6080) Fixed JDK being used in Docker image instead of JRE (#6089) (thanks, @mvanhorn Matt Van Horn!) Fixed editing a video feed on the web settings erases the URL (#6046) (thanks, @serinekjo kjo!) Fixed docs for FFmpeg GPU support (thanks, @Harshit-dell Harshit Kumar Sahu!) Translation updates via Crowdin Dutch (97%) (thanks, Lefteye!) English (United Kingdom) (80%) (thanks, Andi Chandler!) Italian (63%) (thanks, parduz!) Portuguese (Brazilian) (67%) (thanks, Henrique Campos!) Download: Universal Media Server 15.6.0 | 157.0 MB (Open Source) Download: Other operating systems View: Universal Media Server Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Very Popular
      Captain_Eric earned a badge
      Very Popular
    • One Month Later
      amusc earned a badge
      One Month Later
    • One Month Later
      DJC50PLUS earned a badge
      One Month Later
    • Week One Done
      DJC50PLUS earned a badge
      Week One Done
    • Proficient
      Eric Biran went up a rank
      Proficient
  • Popular Contributors

    1. 1
      +primortal
      509
    2. 2
      PsYcHoKiLLa
      222
    3. 3
      ATLien_0
      92
    4. 4
      +Edouard
      86
    5. 5
      Steven P.
      81
  • Tell a friend

    Love Neowin? Tell a friend!