Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Proxy script

$
0
0

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\In ternet 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\In ternet Settings" /v ProxyServer /t REG_SZ /d "192.168.99.1:808" /f
:: Set the bypass proxy server for local addresses option - <local> ticks the box each subsequent entry is additional domains to bypass for
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings" /v ProxyOverride /t REG_SZ /d "<local>;*.local;www.dontproxy.com" /f
GOTO END
:OFF_LAN
::**************Proxy OFF**************
REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\In ternet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
:END
::-----------------------End Script------------------------------------

Can anyone help?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>