+ Post New Thread
Results 1 to 14 of 14
Windows 7 Thread, Proxy detection script in Technical; Hi all, Basically we have users that will use dongles to work from home when they are not in one ...
  1. #1

    Join Date
    Feb 2014
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Proxy detection script

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

  2. #2

    Join Date
    Jun 2011
    Location
    Caister On Sea
    Posts
    1
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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\Curr entVersion\Internet Settings\ProxyServer"
    objShell.RegWrite RegLocate,"PROXY ADDRESS HERE:PORT HERE","REG_SZ"
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Internet Settings\ProxyEnable"
    objShell.RegWrite RegLocate,"1","REG_DWORD"
    MsgBox "School Proxy is Enabled"
    else
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Internet Settings\ProxyServer"
    objShell.RegWrite RegLocate,"0.0.0.0:80","REG_SZ"
    RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\Curr entVersion\Internet Settings\ProxyEnable"
    objShell.RegWrite RegLocate,"0","REG_DWORD"
    MsgBox "School Proxy is Disabled"
    End If
    WScript.Quit
    -----------------------------------------------------------------------------------

  3. #3

    Join Date
    Feb 2014
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Thanks Darren but im trying to avoid the user intervention! Every user here will just say no and spend the day on facebook!

  4. #4

    Join Date
    Jan 2014
    Location
    Isle Of Wight
    Posts
    86
    Thank Post
    94
    Thanked 8 Times in 8 Posts
    Rep Power
    3
    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.
    Last edited by IWDave; 12th February 2014 at 03:54 PM.

  5. #5

    Join Date
    Feb 2014
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Could i get a copy of that?

  6. #6

    Join Date
    Sep 2012
    Posts
    40
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    5
    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..

  7. #7

    Join Date
    Jan 2014
    Location
    Isle Of Wight
    Posts
    86
    Thank Post
    94
    Thanked 8 Times in 8 Posts
    Rep Power
    3
    Sure can, give me a mo to package it up.

  8. #8

    Join Date
    Feb 2014
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    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.

  9. #9

    Join Date
    Sep 2012
    Posts
    40
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    5
    Are you unable to just select one large pool that covers all sites rather than each site individually?

  10. #10

    Join Date
    Jan 2014
    Location
    Isle Of Wight
    Posts
    86
    Thank Post
    94
    Thanked 8 Times in 8 Posts
    Rep Power
    3
    Attachment 22849

    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.
    Last edited by IWDave; 12th February 2014 at 04:17 PM.

  11. #11

    Join Date
    Dec 2013
    Location
    North East
    Posts
    54
    Thank Post
    15
    Thanked 19 Times in 12 Posts
    Rep Power
    5
    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.

  12. #12

    Join Date
    Feb 2014
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hi IWdave, For some reason i cant download that attachment. I get a "Invalid attachment" message from the Edugeeks site?

  13. #13

    Join Date
    Feb 2014
    Posts
    6
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Hi JB2201,
    Thats pretty much what i want but i have been unable to get a script that will do that.

  14. #14

    Join Date
    Jan 2014
    Location
    Isle Of Wight
    Posts
    86
    Thank Post
    94
    Thanked 8 Times in 8 Posts
    Rep Power
    3
    Script on its way to you - sorry had to remove it to remove some sensitive info, just didn't get round to re-uploading it.. So here you go.
    Attached Files Attached Files
    Last edited by IWDave; 24th February 2014 at 04:37 PM.

SHARE:
+ Post New Thread

Similar Threads

  1. Proxy Setting Script per IP Address
    By Arcath in forum Windows 7
    Replies: 1
    Last Post: 24th November 2009, 10:51 AM
  2. Proxy Changer Script
    By plexer in forum Scripts
    Replies: 19
    Last Post: 12th March 2008, 03:20 PM
  3. Proxy Authentication Script - HELP!!!!!
    By chrisa in forum Scripts
    Replies: 9
    Last Post: 7th March 2008, 04:34 PM
  4. proxy server script
    By chrbb in forum How do you do....it?
    Replies: 2
    Last Post: 7th March 2007, 10:57 PM
  5. Interesting proxy script
    By GrumbleDook in forum Scripts
    Replies: 8
    Last Post: 9th December 2005, 01:06 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •