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