Jump to content

Enable/Disable Network connection


Recommended Posts

Link to post
Share on other sites

Sure something like this would come in handy at some point, except it does not appear to work for me, meaning the connection is not disabled, or indeed enabled.

Win 7 32

$oNetCManager:1
$pIEnumNetConnection: 5543260
$oIEnumNetConnection: 1
$pConnection: 5543404 $iCount: 1
$oConnection: 1
$pConnection: 5543404 $iCount: 1
$oConnection: 1

 

 

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to post
Share on other sites

 

Sure something like this would come in handy at some point, except it does not appear to work for me, meaning the connection is not disabled, or indeed enabled.

Win 7 32

 

 

¿Do you get some return value? I made the code in window 7 x64. Thanks for report. I'll check in Windows x86 Saludos

Very impressive (as usual)!

Thank you for sharing.

Also, better than WMI ....

Thanks jguinch :) Saludos

Link to post
Share on other sites

Great job! :thumbsup:

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to post
Share on other sites

 

Sure something like this would come in handy at some point, except it does not appear to work for me, meaning the connection is not disabled, or indeed enabled.

Win 7 32

 

 

I've checked in windows 7 x86 and work correctly.  be sure that your're running with  admin rights. Saludos

Link to post
Share on other sites

Yes, my mistake, works just fine using #RequireAdmin.

Thanks.

You're Wellcome :)  :thumbsup:

Saludos

Link to post
Share on other sites
  • 2 months later...

That disables all adapters.

 
This is how it is individually done. Hope you still need it or are interested =)
actual cmd.exe commands are in blue. The number you get from your wmic nic get name, index list is x
 
Start elevated Command Prompt. (administrator rights)
 
Get NIC list and index number: (using this commands is what tells you what x you are looking for)
wmic nic get name, index
 
Enable NIC with index number: (for example 7, or 12)
wmic path win32_networkadapter where index=x call enable
 
Disable NIC with index number: (for example 7, or 12)
wmic path win32_networkadapter where index=x call disable
 
for me I wanted to cycle the wireless usb internet connection which was device ID 12.
7 is my LAN adapter

post-89858-0-19131800-1422689374_thumb.p

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...