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.

  BudMan said:
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

    • That explains my recent issues with classic Outlook. I can see the FORMS2 folder has resolved the issue on my system.
    • Brave 1.79.126 by Razvan Serea Brave Browser is a lightning-fast, secure web browser that stands out from the competition with its focus on privacy, security, and speed. With features like HTTPS Everywhere and built-in tracker blocking, Brave keeps your online activities safe from prying eyes. Brave is one of the safest browsers on the market today. It blocks third-party data storage. It protects from browser fingerprinting. And it does all this by default. Speed - Brave is built on Chromium, the same technology that powers Google Chrome, and is optimized for speed, providing a fast and responsive browsing experience. Brave Browser also features Brave Rewards, a system that rewards users with Basic Attention Tokens (BAT) for viewing opt-in ads. This innovative system provides an alternative revenue model for content creators and a way to support the Brave community. Brave 1.79.126 changelog: Fixed crash when clicking on shields panel in certain cases. Fixed crash on navigation when a Google sign-in request has been triggered. (#46769) Fixed crash when Leo generates empty list when clicking on “Suggest questions” while using BYOM (Bring Your Own Model). (#46843) Fixed issue importing from Trezor wallet when Trezor Connect is outdated. (#46660) Upgraded Chromium to 137.0.7151.119. (#46911) Download: Brave Browser 64-bit | 1.2 MB (Freeware) Download: Brave Browser 32-bit View: Brave Homepage | Offline Installers | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • LeafView 3.6.5 by Razvan Serea LeafView is a fast, open-source image viewer built with Electron. It offers a sleek, minimal UI for fast and efficient image browsing. Supporting various formats, LeafView ensures a smooth viewing experience with essential features like zoom, rotation, and slideshow mode. Designed for simplicity and performance, it utilizes hardware acceleration for smooth rendering and supports touch gestures for seamless navigation. LeafView key features: Lightweight & Open-Source – Minimal resource usage with a clean, efficient design Electron-Based – Cross-platform compatibility with modern UI Multiple Image Format Support – Opens JPG, PNG, GIF, BMP, and more Smooth Rendering – Hardware acceleration for fast performance Essential Image Controls – Zoom, rotate, and slideshow mode Touch Gesture Support – Seamless navigation on compatible devices Minimal UI – Focused on simplicity and ease of use LeafView 3.6.5 changelog: Update electron to v36.5.0 Download: LeafView 3.6.5 | Portable | ~100.0 MB (Open Source) View: LeafView Website | Other operating systems | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Which is why I continue to use Open Shell for my start menu. your best course of action is to install a third-party Start menu
  • Recent Achievements

    • First Post
      Fuzz_c earned a badge
      First Post
    • First Post
      TIGOSS earned a badge
      First Post
    • Week One Done
      slackerzz earned a badge
      Week One Done
    • Week One Done
      vivetool earned a badge
      Week One Done
    • Reacting Well
      pnajbar earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      700
    2. 2
      ATLien_0
      280
    3. 3
      Michael Scrip
      208
    4. 4
      +FloatingFatMan
      196
    5. 5
      Steven P.
      130
  • Tell a friend

    Love Neowin? Tell a friend!