Kaseya Community

Script to change IE proxy settings for all users

  • Can someone help me with a script to change the IE proxy settings on a PC for all users. We are not on a domain and not using GP and so have to change these manually now.

    Thanks

    Legacy Forum Name: Script to change IE proxy settings for all users,
    Legacy Posted By Username: MikeLayman
  • MikeLayman
    Can someone help me with a script to change the IE proxy settings on a PC for all users. We are not on a domain and not using GP and so have to change these manually now.

    Thanks


    Mike,

    Try something like this (Be sure to change Parameter 2!):

    Script Name: Set Proxy Server
    Script Description:

    IF User Is Logged In
    Parameter 1 :
    THEN
    Execute File
    Parameter 1 : %systemroot%\system32\proxycfg.exe
    Parameter 2 : -p 192.168.0.1:3128
    Parameter 3 : 1
    OS Type : 0
    ELSE
    Execute File
    Parameter 1 : %systemroot%\system32\proxycfg.exe
    Parameter 2 : -p 192.168.0.1:3128
    Parameter 3 : 3
    OS Type : 0

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Zestysoft
  • MikeLayman
    Can someone help me with a script to change the IE proxy settings on a PC for all users. We are not on a domain and not using GP and so have to change these manually now.

    Thanks


    Something along similar lines. I have an agent on my laptop PC, we have a proxy on the Office LAN - I got sick of remembering to turn the proxy on and off as I plugged into the various networks I use.

    I have setup the kaseya server to run a script whenever my agent checks in, the script checks the local LAN IP settings and calls a second script to check on the LAN IP range and then sets IE proxy settings accordingly.

    There are probably better ways to do this, e.g. checking the Agent gateway address but this works for me on a single machine basis.

    Here are the two scripts, don't firget to modify the values as required. And any script gurus out there, please feel free to suggest improvements.

    Paul

    Script Name: Set IE Proxy Step 1
    Script Description: Runs IPconfig and loads the output into a variable - calls step 2 script. Intent of script pair is to turn on IE proxy on Office LAN, otherwise turn IE proxy off.

    IF True
    THEN
    Get Variable
    Parameter 1 : 5
    Parameter 2 :
    Parameter 3 : tempdir
    OS Type : 1
    Execute Shell Command
    Parameter 1 : ipconfig >> #tempdir#\ip.txt
    Parameter 2 : 0
    OS Type : 1
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #tempdir#\ip.txt
    Parameter 3 : ip
    OS Type : 1
    Execute Script
    Parameter 1 : Set IE Proxy step 2 (NOTE: Script reference is NOT imported. Correct manually in script editor.
    Parameter 2 :
    Parameter 3 : 0
    OS Type : 1
    ELSE

    *******

    Script Name: Set IE Proxy step 2
    Script Description: Evaluates variable returned in Step 1. If IPconfig data contains entries related to Office LAN then turns on appropriate proxy settings, otherwise turns the proxy off.

    IF Check Variable
    Parameter 1 : #ip#
    Contains :192.168.105.
    THEN
    Set Registry Value
    Parameter 1 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable
    Parameter 2 : 1
    Parameter 3 : REG_DWORD
    OS Type : 1
    Set Registry Value
    Parameter 1 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer
    Parameter 2 : 192.168.105.254:8080
    Parameter 3 : REG_SZ
    OS Type : 1
    Set Registry Value
    Parameter 1 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride
    Parameter 2 : machine.domainname.com;<>
    Parameter 3 : REG_SZ
    OS Type : 1
    Write Script Log Entry
    Parameter 1 : Proxy settings turned on
    OS Type : 1
    ELSE
    Set Registry Value
    Parameter 1 : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable
    Parameter 2 : 0
    Parameter 3 : REG_DWORD
    OS Type : 1
    Write Script Log Entry
    Parameter 1 : Proxy settings turned off
    OS Type : 1

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Paul@Kadec