Jump to content

Recommended Posts

Posted

Hi all,

Basically we have users that will use dongles to work from home when they are not in one of our offices. We need the proxy settings to be disabled when they are not on the network and we dont really want the users having to change the setting themselves.

 

 

The website PeteNetLive - KB0000181 - Defining / Locking and Managing Proxy Settings gave me this which basically will ping the proxy, If it responds it turns the proxy on, If it doesnt it turns it off. The script doesnt seem to work though, i get a Microsoft VBScript Compilation error. This is before and after i put my settings in. I unfortunatly am not very good a VBS scripts. Can anyone assist?

Thanks

 

::-----------------------Begin Script------------------------------------ @echo OFF

:: Check LAN connectivity

PING 192.168.99.254 | FIND "TTL" > NUL

IF NOT ERRORLEVEL 1 GOTO ON_LAN

GOTO OFF_LAN

:ON_LAN

::**************Proxy ON**************

::Enable the Proxy Server (ticks the box "user a proxy server for your LAN...")

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f

:: SET the proxy (fills in the Address and port values)

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d "192.168.99.1:808" /f

:: Set the bypass proxy server for local addresses option - ticks the box each subsequent entry is additional domains to bypass for

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d ";*.local;www.dontproxy.com" /f

GOTO END

:OFF_LAN

::**************Proxy OFF**************

REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

:END

::-----------------------End Script------------------------------------

Posted

Don't know whether this is any good. We put this in the startup of all staff laptops so when they switch on it asks if they want to use the school proxy or not. All they have to do is select yes if they are in school and using the proxy or no if they are elsewhere. Copy the text and paste into notepad saving as a .vbs. Hope it helps.

 

--------------------------------------------------------------------------

Option Explicit

Dim valUserIn

Dim objShell, RegLocate, RegLocate1

Set objShell = WScript.CreateObject("WScript.Shell")

On Error Resume Next

valUserIn = MsgBox("Use School Proxy?",4,"School Proxy Select")

If valUserIn=vbYes Then

RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"

objShell.RegWrite RegLocate,"PROXY ADDRESS HERE:PORT HERE","REG_SZ"

RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"

objShell.RegWrite RegLocate,"1","REG_DWORD"

MsgBox "School Proxy is Enabled"

else

RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"

objShell.RegWrite RegLocate,"0.0.0.0:80","REG_SZ"

RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"

objShell.RegWrite RegLocate,"0","REG_DWORD"

MsgBox "School Proxy is Disabled"

End If

WScript.Quit

-----------------------------------------------------------------------------------

Posted (edited)
We have a solution that is tied into their local startup script on entering windows, It lists all the wireless SSIDs and if the school's is found it assumes that you are on site and therefor attaches the proxy, if not then it removes it and makes the home page google.co.uk; if it can't find our servers either by wifi or wired then the same thing happens; so its a to pronged attack. works very well for us. No User intervention at all. I'm happy to share but it requires quite a few changes in the script to point to your own servers and SSID, so might need a conversation walk through. Its pushed out by GPO, but once its done its fully automated by the local machine. Edited by IWDave
Posted
We use a Proxy pac file, specified in a GPO. Uses the IP address of the machine, if it's a school IP then apply proxy, if it isn't, then remove it. No user intervention, can also applies exceptions etc..
Posted

Hi Liam,

I looked at that as a possible solution however our company is large with over 200 sites so capturing all those ranges will make it very admin intensive.

Posted (edited)

[ATTACH]22849[/ATTACH]

 

Unzip it

Modify proxywin7.reg as required

Modify link.bat

Modify Wireless SSID FOR NAP.bat as required to skip desktops and which servers to ping as well as the SSID

Modify Wireless Network Connection-NAP.xml to install your wirelesskey automatically

run Autolink.bat

It should create a folder called session\wireless\ under drive c:

This will then check the state of play every time you login

 

When distributing via GPO or login script, place all the files on a network resource and get it to run AutoLink.bat from there; this file will copy and setup its bits automatically locally on the machine that its run for.

Edited by IWDave
Posted
Why not just ping one or more of the DC servers and if you get a response back then enable the proxy? I might be missing something but it should only ever enable then if the computer is on the same LAN as the DC's.
  • 2 weeks later...

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



×
×
  • Create New...