Sign in to follow this  
Followers 0
kevinbarker

howto?? disable IE proxy for few minutes then re-enable???? help

6 posts in this topic

Here is a bit of background, as to why i would want to disable the proxy server for a few minutes, then re enable it.

at work we have a proxy server for laptop's and work station. When laptop users work out the office and connect to a (hosted) wifi hotspot, e.g. when you open a internet explorer you are redirected to enter a user name + password to gain access to the internet.

Because we have the proxy server, users are not able to see the login page.

So we want to run a .exe that will edit the registry to disable the proxy server, launch ie ( so user's can log into a hosted wifi )

once say 3 minutes has passed, we need to re enabe the proxy BUT.. with out closing I.E down.

I have seen a way todo this to force the machine to re-read the registry, but lack the knoledge on how todo this, can anyone HELP????? please.

This is what i have done in a batch file so far.. if any one can help a massive THANK YOU in advance.

@echo off

cls

set reg=HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings

Reg Add "%reg%" /v "ProxyEnable" /t "REG_DWORD" /d "0" /f

start iexplore http://www.google.co.uk

::Wait and add reg key 1

Timeout /T 120

Reg Add "%reg%" /v "ProxyEnable" /t "REG_DWORD" /d "1" /f

Share this post


Link to post
Share on other sites



" proxy BUT.. with out closing I.E down ..."

Mmmh,

that may be only possible if you use "Internetoptions" direct. You can try:

rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,4

in combination with controlsend (and move it out of the visible screen).

I did something like that with regional settings, to change from point to comma and back.

But that was only for me, as IT-Guy I would avoid solutions like that.

HTH, Reinhard

Share this post


Link to post
Share on other sites

Hi Reinhard

many thanks for the information. i have just started to use auto script it, would you be able to help with any of the code?

again thanks for pointing me int he right direction.

Share this post


Link to post
Share on other sites

OK, just trying to sort this out manually for the moment.

Here is the latest code i have , if i run the scripts seperatly they work fine, if i want the script to run in the background, and sat run the proxy off after 2 minutes is does not work ;) can anyone help ??

#include <IE.au3>

$PXYSVR = "ccventures.omniquad.com"

$PXYPRT = "8080"

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

$reg = RegWrite($key, "ProxyEnable", "REG_DWORD", "0")

$reg1 = RegWrite($key, "ProxyServer", "REG_SZ", $PXYSVR & ":" & $PXYPRT)

DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

Sleep(2000)

$oIE = _IECreate("http://www.google.co.uk")

Sleep(8000)

;;PROXY OFF

$key = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings"

$reg = RegWrite($key, "ProxyEnable", "REG_DWORD", "1")

DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

Sleep(2000)

Share this post


Link to post
Share on other sites

Did you have any luck with this in the end? - I had a similar issue but have recently learned that the dll call will only work once per browser session, subsiquent calls seem to make the settings revert to whatever IE remembers.

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  
Followers 0