Jump to content
Sign in to follow this  
zxc3

Switching off Internet connection

Recommended Posts

Prompt, who knows the command (program) switching off Internet connection ?!

Share this post


Link to post
Share on other sites

Open your registry and find the key below.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

Change the value of "ProxyEnable" and set it to "1". Change the value of "ProxyServer" and set it to an IP address and port that is invalid on your network such as "10.0.0.1:5555" (i.e. "IP:Port").

By changing these settings Internet access will be disabled for any applications that rely of the Microsoft proxy server information such as Internet Explorer, Microsoft Office, Opera browser.

To stop users from modifying the proxy settings add these restrictions to disable changes to the Internet configuration.

Find or create the key below:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel

Create two DWORD values named "Connection Settings" and "Connwiz Admin Lock" and set them both to "1".

To remove the restriction, set the proxy settings back to their original values and delete the policy values.

Note: The change will take effect immediately for any new browser windows, existing Internet Explorer sessions will not be affected until the browser is closed and reopened.


qq

Share this post


Link to post
Share on other sites

Open your registry and find the key below.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings

Change the value of "ProxyEnable" and set it to "1". Change the value of "ProxyServer" and set it to an IP address and port that is invalid on your network such as "10.0.0.1:5555" (i.e. "IP:Port").

By changing these settings Internet access will be disabled for any applications that rely of the Microsoft proxy server information such as Internet Explorer, Microsoft Office, Opera browser.

To stop users from modifying the proxy settings add these restrictions to disable changes to the Internet configuration.

Find or create the key below:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel

Create two DWORD values named "Connection Settings" and "Connwiz Admin Lock" and set them both to "1".

To remove the restriction, set the proxy settings back to their original values and delete the policy values.

Note: The change will take effect immediately for any new browser windows, existing Internet Explorer sessions will not be affected until the browser is closed and reopened.

<{POST_SNAPBACK}>

Thank you , but something is easier, I do not need to block the Internet for users,

Simply to break off connection.

Share this post


Link to post
Share on other sites

Thank you , but something is easier, I do not need to block the Internet for users,

Simply to break off connection.

<{POST_SNAPBACK}>

Please explain more... Edited by Burrup

qq

Share this post


Link to post
Share on other sites

Prompt, who knows the command (program) switching off  Internet connection ?!

might try this. Will disable your network interface. Run it once to disable.

Run it again to re-enable.

$windowtitle = "Network Connections"
$adapter = "Your adapter name here"; <<=== Change this !!

Run("control.exe ncpa.cpl")
WinWait($title)
ControlListView($title, "", "SysListView321", "Select", ControlListView($title,"","SysListView321","FindItem",$adapter) )
WinWaitActive($title)
ControlSend($title, "", "SysListView321", "+{F10}{DOWN}{ENTER}")
WinClose($title)

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

This may be what you need:

$FALSE = 0
$TRUE = NOT $FALSE

Func SOff()
    RunWait("ipconfig /release", "c:/", @SW_HIDE)
    ProcessWaitClose("ipconfig.exe")
    Return $FALSE
EndFunc  ;==>SOff

Func SOn()
    RunWait("ipconfig /renew", "c:/", @SW_HIDE)
    ProcessWaitClose("ipconfig.exe")
    Return $TRUE
EndFunc  ;==>SOn

Reply if you require explanation.

J

Edited by jdickens

If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
Share on other sites

Thanks for your advice. I used the following program for an input in the Internet (for Dial up) for already open window Internet Explorer. I understand, what is it silly. Prompt as standardly to connect and disconnect Internet.

$handle =WinGetHandle("The page", "")

While $J <= 3

ControlSend($handle, "", "Internet Explorer_Server1", "{F5}")

sleep(1000)

ControlSend($handle, "", "Internet Explorer_Server1", "{BACKSPACE}")

send("{ENTER}")

$J=$J+1

wend

Share this post


Link to post
Share on other sites

Hi All!

I'm a newcomer to AutoIt (got wise to it yesterday), but have already managed to practice some coding. Since one of my urging tasks was similar to this one discussed here (toggle LAN connection on and off), I spent some time trying to script that. I've tried some solutions offered here: http://www.autoitscript.com/forum/index.php?showtopic=12034 and here: http://www.autoitscript.com/forum/index.php?showtopic=12645, but they didn't work too fine. So I've found what seems a more robust solution. I don't know if it works on any other OSs other than mine (Windows XP SP3), but it seems to be entirely independent of local languages (it doesn't use "verbs" and system folder names). I just found a free Microsoft product - a console-run device manager called devcon (try googling it or searching in MSDN). This tool can enable / disable any device using WinAPI and given the device's ID (a string value). So my task in AutoIt boiled down to writing a wrapper.

And here it is:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=LAN_Control_ENG.exe
#AutoIt3Wrapper_Run_Tidy=y
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstantsEx.au3>

Global Const $DEVCON = @ScriptDir & "\devcon.exe"

Func Connect($bConnect = True)

    If $bConnect = True Then
        If ShellExecute($DEVCON, "enable ms_pschedmp", "", "", @SW_HIDE) = 1 Then; "ms_pschedmp" is the LAN devices ID
            Return True
        Else
            Return False
        EndIf
    Else
        If ShellExecute($DEVCON, "disable ms_pschedmp", "", "", @SW_HIDE) = 1 Then; "ms_pschedmp" is the LAN devices ID
            Return True
        Else
            Return False
        EndIf
    EndIf

EndFunc ;==>Connect

$gui = GUICreate("LAN Control", 155, 80)
$gui_label = GUICtrlCreateLabel("Choose option:", 30, 10)
$gui_b_OK = GUICtrlCreateButton("Enable LAN", 5, 40, 70, 30)
$gui_b_Cancel = GUICtrlCreateButton("Disable LAN", 80, 40, 70, 30)

GUISetState(@SW_SHOW)

While 1

    $msg = GUIGetMsg()

    Select
        Case $msg = $gui_b_OK

            If Connect() Then
                MsgBox(64, "OK!", "LAN enabled!")
                ExitLoop
            Else
                MsgBox(48, "Error!", "An error occurred!")
                ExitLoop
            EndIf

        Case $msg = $gui_b_Cancel
            If Connect(False) Then
                MsgBox(64, "OK!", "LAN disabled!")
                ExitLoop
            Else
                MsgBox(48, "Error!", "An error occurred!")
                ExitLoop
            EndIf

        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

    EndSelect
WEnd

Here's a RAR file containing the above source code, a compiled EXE, and devcon (for i386 systems):

http://narod.ru/disk/7051598000/LanControl.rar.html

Please comment! :D

Share this post


Link to post
Share on other sites

You might want to make a post in the Examples forum to get comments etc...


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

You might want to make a post in the Examples forum to get comments etc...

I'll do that as soon as the admins let me post in the Examples :D

Share this post


Link to post
Share on other sites

hi guys, i just noticed this thread, but there is a WMI service option also to disable adapters. i will post the information here soon.

based on this, http://msdn.microsoft.com/en-us/library/aa394216(VS.85).aspx i actually use my script to enumerate the adapters, i will do the mods to enable or disable the network adapter,

one small note S0mbre, if devs dont mistake me, as i am always concerned about EULA issues, i would like to mention, just post the link to dev con download and post your script that will free your script (which is for personal use of who ever downloads it) from any redistribution related issues. pls dont mistake me.

Share this post


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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...