I am trying to make a script to change the proxy on a few pc's throughout our organization that will need to point to a specific proxy server and port. The script below seems close but I am struggling with a few things first it doesn't actually seem to change the values. It runs as if everything is fine but then when I check the settings to verify them it is not enabled. The second issue is when you do click Enable it prompts you to enter the ip, which I have set to 127.0.0.0 for testing, but clicking cancel does nothing. I would like it to just close and not try to set anything in case someone makes a mistake.
[ autoit ]
#RequireAdmin Dim $sTitle = "IE Proxy is:" Dim $Proxy = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyEnable") ;MsgBox(0,"",$Proxy) If $Proxy = 0 Then MsgBox(8228,$sTitle, @TAB & " Disabled" & @CRLF & " Would you like to Enable it now?") $ProxyIP = 0 While Not $ProxyIP Select case $ProxyIP = 0 $ProxyIP = InputBox("Proxy IP", "Type in the desired proxy address.","127.0.0.1") EndSelect WEnd $sProxy = RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "Proxyenable", "REG_DWORD", "1") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "proxyserver", "REG_SZ",$ProxyIP) RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "proxyoverride", "REG_SZ", "*.local;<local>") ElseIf $Proxy = 1 Then MsgBox(8228,$sTitle, @TAB & " Enabled" & @CRLF & " Would you like to Disable it now?") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "Proxyenable", "REG_DWORD", "0") EndIf