; ===========================================================================================
$ = MessageBox("Checking Group Membership", "AD Group Check ", 0)
If InGroup ("XXXXXXX-US") ;Run this if you are in this group
;setproxy(0,,1) ;remove per user settings
;setproxy(0,,0) ;remove per machine settings
setproxy(1,"XXXXXXX",1) ;set per user settings
;setproxy(1,"XXXXXX",0) ;set per machine settings
? "You will now be migrated to the new proxy server. Please wait..."
Sleep 3
? "-- Updating Internet Explorer Proxy settings."
? ========================================================
? ========================================================
? "-- Done with updating Internet Explorer Proxy settings."
?
?
EndIf
Function SetProxy($type, optional $Proxy, optional $PerUser)
;Type:
; 0 - disable proxy
; 1 - enable proxy
;Proxy:
; proxy.domain.com:80
;PerUser
; 1 or not nul - to make proxy settings per user, requires admin privledes
; 0 - to make proxy settings per Machine, requires admin privledes
;
;returns
; 1 - Incorrect Type
; 2 - no proxy server specified
; 3 - policy is set to per machine / requires admin priv
Dim $regkey, $admin, $gpkey
$admin = InGroup("@wksta\Administrators")
$Regkey='HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion'
$gpkey ='HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion'
If $admin
If $PerUser>0 ; "per user"
$=WriteValue("$gpkey\Internet Settings","ProxySettingsPerUser","1",REG_SZ)
$=WriteValue("$Regkey\Internet Settings","ProxySettingsPerUser","1",REG_SZ)
EndIf
If Len($peruser)>0 And $PerUser=0 ; "per machine"
$=WriteValue("$gpkey\Internet Settings","ProxySettingsPerUser","0",REG_SZ)
$=WriteValue("$Regkey\Internet Settings","ProxySettingsPerUser","0",REG_SZ)
EndIf
Else
If ReadValue("$Regkey\Internet Settings","ProxySettingsPerUser")=0
Or ReadValue("$gpkey\Internet Settings","ProxySettingsPerUser") =0
Exit 3
Return
EndIf
$Regkey='HKEY_Current_User\SOFTWARE\Microsoft\Windows\CurrentVersion'
EndIf
If ReadValue("$Regkey\Internet Settings","ProxySettingsPerUser")=1
Or ReadValue("$gpkey\Internet Settings","ProxySettingsPerUser") =1 ; "per user is set"
$Regkey='HKEY_Current_User\SOFTWARE\Microsoft\Windows\CurrentVersion'
EndIf
Select
Case $Type=1 And $Proxy
$=WriteValue("$Regkey\Internet Settings","ProxyServer","$Proxy",REG_SZ)
$=WriteValue("$Regkey\Internet Settings","ProxyEnable","1",REG_DWORD)
$=WriteValue("$Regkey\Internet Settings","ProxyOverride","<local>",REG_SZ)
Case $Type=0
$=WriteValue("$Regkey\Internet Settings","ProxyServer","",REG_SZ)
$=WriteValue("$Regkey\Internet Settings","ProxyEnable","0",REG_DWORD)
$=WriteValue("$Regkey\Internet Settings","ProxyOverride","<local>",REG_SZ)
Case $Type=1
Exit 2
Case 1
Exit 1
EndSelect
EndFunction